获取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;
        }
posted @ 2009-06-23 10:06  迪卡.凯恩  阅读(346)  评论(0编辑  收藏  举报