Accessing a List of Table Names using ODBC.NET -
07-29-2003
, 09:56 AM
I'm using ODBC.NET to read tables over an InterSystems Cache ODBC
connection. I've been able to access table data, I can return columns
and all properties of the columns from a given table... I just can't
seem to get a list of Tables. Does anyone have any suggestions? Is
there a way to get to it without having to use a Command? I've tried
different CommandText values, but am not sure what to put there.
__________________________________________________ _________________________
DataTable dt = new DataTable();
OdbcCommand cmd = new OdbcCommand();
OdbcDataAdapter da = new OdbcDataAdapter();
string ConnectionString = "Provider=MSDASQL;DSN=DEF;";
OdbcConnection con = new OdbcConnection(ConnectionString);
con.Open();
cmd.Connection = con;
cmd.CommandType = CommandType.Text;
cmd.CommandText = "SELECT * FROM ADJ_REASON_NOTES";
OdbcDataReader rdr = cmd.ExecuteReader(CommandBehavior.SchemaOnly);
dt = rdr.GetSchemaTable();
rdr.Close();
con.Close();
return dt; |