获取所有Access数据库中的名表方法
protected
void
Page_Load(
object
sender, EventArgs e)
{
OleDbConnection con = new OleDbConnection( " Provider = Microsoft.ACE.OLEDB.12.0; Data Source = |DataDirectory|/mm.accdb; " );
con.Open();
DataTable dt = con.GetSchema( " tables " );
GridView1.DataSource = dt;
GridView1.DataBind();
}
{
OleDbConnection con = new OleDbConnection( " Provider = Microsoft.ACE.OLEDB.12.0; Data Source = |DataDirectory|/mm.accdb; " );
con.Open();
DataTable dt = con.GetSchema( " tables " );
GridView1.DataSource = dt;
GridView1.DataBind();
}
以上方法测试通过。不过也有系统表的名称,还要再过滤,才能得到纯用户所建的表名