// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Data; using System.Data.OleDb; class MainClass { public static void Main(string[] args) { OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\Database\\MSAccess\\Test.mdb"); con.Open(); /* OleDbCommand cmd = new OleDbCommand("SELECT name FROM MSysObjects WHERE type=1 AND flags=0", con); OleDbDataReader rdr = cmd.ExecuteReader(); while(rdr.Read()) { Console.WriteLine(rdr[0]); } */ string[] criteria = {null, null, null, "TABLE" }; DataTable dt = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, criteria ); for(int i = 0; i < dt.Rows.Count; i++) { Console.WriteLine(dt.Rows[i][2]); } con.Close(); } }