日期:2014-05-17 浏览次数:20835 次
string Path=System.Windows.Forms.Application.StartupPath + @"\\EBalance.mdb";
OleDbConnection con;
con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Path);
if (con.State == ConnectionState.Closed)
{
con.Open();
}
#endregion
#region
///判断某个数据表是否存在
if (GetTables(con, DataName)) //表存在
{
;
}
else //表不存在
{
//con.Close();
//MessageBox.Show(Path);
ADOX.CatalogClass cat = new ADOX.CatalogClass();
//cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Path;//这里出错了
cat.ActiveConnection = con;//这里出错了
ADOX.TableClass tbl = new ADOX.TableClass();
tbl.ParentCatalog = cat;
tbl.Name = DataName;