获取Access中的所有用户表(例子)
//检索ACCESS库里的所有属于用户的表
public DataView GetTable()
{
string sAccessConnection = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + @"\DataSourece\Ticket.mdb;" + "Persist Security Info=True";//连接字符串
OleDbConnection conn = new OleDbConnection(sAccessConnection);//OLEDB连接
conn.Open();
DataTable tblSch = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
DataView view = tblSch.DefaultView;
view.RowFilter = "table_type='table' or table_type='view'";
return view;
}
public DataView GetTable()
{
string sAccessConnection = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application.StartupPath + @"\DataSourece\Ticket.mdb;" + "Persist Security Info=True";//连接字符串
OleDbConnection conn = new OleDbConnection(sAccessConnection);//OLEDB连接
conn.Open();
DataTable tblSch = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);
DataView view = tblSch.DefaultView;
view.RowFilter = "table_type='table' or table_type='view'";
return view;
}