View RSS Feed

benrwb

  1. Getting a list of tables in an Access database (C#)

    by , 4th March 2011 at 11:13 AM
    Posting this code so that I can remember it/ and in case anyone else finds it useful.

    First open the database
    Code:
    string constr = @"Provider=Microsoft.Jet.OLEDB.4.0;Data source=database.mdb";
    OleDbConnection con = new OleDbConnection(constr);
    con.Open();
    con.GetSchema() will return a list of collections in the database.

    Code:
    CollectionName        NumberOfRestrictions NumberOfIdentifierParts
    --------------------- --------------------
    ...