Unable to list correct tables with OleDbSchemaTable

M

Michael

Hi,

I'm using OleDbConnection.GetOleDbSchemaTable() to obtain the name of
all the tables in an access database. This is a bit of my code:

OleDbConnection connection = new
OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
mdbFile + ";Mode=Read;
connection.Open();

Object[] objArray = new Object[]{null, null, null, "TABLE"};
DataTable table;
table = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,
objArray);
connection.Close();

foreach (DataRow row in table.Rows)
{
string tableName = (string)row["TABLE_NAME"];
}

My database has 34 tables, and I'm only to able to 26 of them. Could
anyone PLEASE help me figure this out?

Thanks alot!

Michael
 
P

Paul Clement

¤ Hi,
¤
¤ I'm using OleDbConnection.GetOleDbSchemaTable() to obtain the name of
¤ all the tables in an access database. This is a bit of my code:
¤
¤ OleDbConnection connection = new
¤ OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
¤ mdbFile + ";Mode=Read;
¤ connection.Open();
¤
¤ Object[] objArray = new Object[]{null, null, null, "TABLE"};
¤ DataTable table;
¤ table = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,
¤ objArray);
¤ connection.Close();
¤
¤ foreach (DataRow row in table.Rows)
¤ {
¤ string tableName = (string)row["TABLE_NAME"];
¤ }
¤
¤ My database has 34 tables, and I'm only to able to 26 of them. Could
¤ anyone PLEASE help me figure this out?

Are any of those missing tables linked or pass-through table types?

If you change the fourth parameter "TABLE" to null do you see all of your tables?


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top