Click here to Skip to main content
15,898,538 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I am trying to list the tables included in a custom group(created in an Access mdb file).

If i use
C#
List<string> tables = new List<string>();
DataTable dt = myAccessConn.GetSchema("Tables");
foreach (DataRow row in dt.Rows)
{
    string tablename = (string)row[2];
    tables.Add(tablename);
}


i will get the list of all the tables from the database. Does anyone know how to do it ?

Thank you,
Vlad
Posted
Comments
Vedat Ozan Oner 7-Mar-14 7:36am    
I couldn't understand what exactly your problem is.
EduChapow 7-Mar-14 8:02am    
what's custom group? is a table in your database?
what's technology with you're using? Entity Framework?

1 solution

DataTable is a single entity within your schema. So don't use it, rather go for DataSet, which is the collection of relational/non-relational DataTable. See my code below,
C#
List<string> tables = new List<string>();
DataSet ds = new DataSet();
foreach (DataTable t in ds.Tables)
{
    tables.Add(t.TableName);
}

-KR
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900