Hi, We have an Oracle 8i database on which I have only read access. We use ODBC and MS Access to read data from that database since we don't have Oracle Client software. This works fine. I am using ADO.NET with ASP.NET. Now I want to display a list of all the tables that I see in MS Access via ODBC. I have tried this with ODBC connection in C#. I am tried the following queries to get the list of tables, which did not work.
- select table_name from dba_tables;
- select table_name from all_tables;
- select tname from tab;
Please help.
Thanks for the response. I tried them without luck. All I want to see is the same list of tables that are available in MS Access when I use ODBC to create Linked Tables.
This is the function that I am using to achieve this, which does not really work the way I would have liked.
public static ArrayList GetODBCTablesList()
{
try
{
OdbcConnection DbConnection = new OdbcConnection("DSN=mydsn;UID=user1;PWD=pwd1;");
DbConnection.Open();
OdbcCommand DbCommand = DbConnection.CreateCommand();
DbCommand.CommandText = "select table_name from all_tables";
OdbcDataReader DbReader = DbCommand.ExecuteReader();
if (DbReader != null)
{
ArrayList TableList = new ArrayList();
while (DbReader.Read())
{
TableList.Add(DbReader.GetString(0));
}
DbReader.Close();
DbCommand.Dispose();
DbConnection.Close();
TableList.Sort();
TableList.TrimToSize();
return TableList;
}
DbCommand.Dispose();
DbConnection.Close();
return null;
}
catch (Exception ex)
{
LogHandler.WriteLogMessage(ex.GetBaseException().ToString(), true);
return null;
}
}
This gives me a list of tables which does not contain all the tables that I see when I link tables in MS Access using ODBC.