returning a list of table objects from a connection

  • Thread starter Thread starter Milsnips
  • Start date Start date
M

Milsnips

Hi there,

i've got a small test application that can either connect to sql server,
oracle or mysql (via odbc). When the connection is active, i want to return
a list of the user tables and list them in a table. Now i know i can get
them using SQLDMO for sql server, but is there anything generic in
System.Data or .NET that can return me the objects regardless which database
i'm connected to?

thanks,
Paul
 
Milsnips said:
i've got a small test application that can either connect to sql server,
oracle or mysql (via odbc). When the connection is active, i want to
return a list of the user tables and list them in a table. Now i know i
can get them using SQLDMO for sql server, but is there anything generic in
System.Data or .NET that can return me the objects regardless which
database i'm connected to?


If you are using an OleDbConnection, you can use GetOleDbSchemaTable:

DataTable schemaTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,
new object[] {null, null, null, "TABLE"});
 
Back
Top