using System;
using System.Data;
using System.Data.OleDb;
public class GetSchema
{
public static void Main()
{
string connectionString = "Data Source=localhost;Provider=SQLOLEDB;Initial Catalog=Northwind;Integrated Security=SSPI";
OleDbConnection con = new OleDbConnection(connectionString);
DataTable schema;
con.Open();
schema = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,new object[] {null, null, null, null});
con.Close();
foreach (DataRow row in schema.Rows){
Console.WriteLine(row["TABLE_TYPE"] + ": " + row["TABLE_NAME"]);
}
}
}
|