none
Find all tables from MS Access 2003 database RRS feed

  • Question

  • Hi.

    I have program what uses Access 2003 database with ODBC. Now when I'm updating program, I like to make one function what updates all tables from database, ok, I know how to do that if I can somehow find list of tables from MS Access (.mdb) database using SQL.

    This works on access : "SELECT Name FROM MsysObjects WHERE (((Id)>=0) AND ((Flags)=0));" but when I try use it from C++, i got only exception. So how to get tablenames with SQL?

    Thanks
    Tuesday, October 23, 2007 7:35 AM

Answers

  • If you can use .NET Managed Provider for OLEDB, then OleDbConnection class has two methods called GetSchema and GetOleDbSchemaTable. They return information about objects in a database. In a case of .NET Managed Provider for ODBC you could use GetSchema of OdbcConnection class to get same information.

     

    Tuesday, October 23, 2007 10:41 AM
    Moderator

All replies

  • If you can use .NET Managed Provider for OLEDB, then OleDbConnection class has two methods called GetSchema and GetOleDbSchemaTable. They return information about objects in a database. In a case of .NET Managed Provider for ODBC you could use GetSchema of OdbcConnection class to get same information.

     

    Tuesday, October 23, 2007 10:41 AM
    Moderator
  • I'm using .Net 1.1 OdbcConnection class, and seems it have GetSchema member. Have to try. Thanks
    Tuesday, October 23, 2007 11:22 AM