Getting database info for SQL

  • Thread starter Thread starter Sylvain Provencher
  • Start date Start date
S

Sylvain Provencher

Hi!

There is a way to obtain tables and fields info from an SQL connection. like
tables name, fields name, type and width ?

I'm writing a VB.NET application.

Thanks
 
What DB are you using? If it's sql server you can use Information_Schema
and find out just about anything. if you fire a query and use a DataReader,
you can also use GetSchemaTable for instance to get most of what you want
regarding individual tables.

HTH,

BIll
 
Actually, I use MS SQL server. I don't use a data reader, but it can be a
way...

Can you send me code snippet if you have it ? Thanks!
 
DataTable dt = new DataTable();

dt = myDataReader.GetScehmaTable();

Querying Information_Schema can do a lot for you too, check out BOL, there's
a bunch of info in there.

HTH,

Bill
 
Back
Top