How to retrieve db table field's max length by using ADO.NET?

C

Chris Botha

Not really, I think the documentation just stinks around this area. You can
use the OleDbDataAdapter. The select string something like "Select * from
MyTable", and then call adapter.FillSchema into a DataTable. It puts the
information into an empty table (no rows), but the Columns contains all the
info needed, length, null-able, primary key, etc.
 
K

Ken Cox [Microsoft MVP]

Thanks Chris. I stand corrected.

Chris Botha said:
Not really, I think the documentation just stinks around this area. You can
use the OleDbDataAdapter. The select string something like "Select * from
MyTable", and then call adapter.FillSchema into a DataTable. It puts the
information into an empty table (no rows), but the Columns contains all the
info needed, length, null-able, primary key, etc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top