获取Access中所有表和所有表字段属性的完美解决办法!不需要引用ADOX

类别:.NET开发 点击:0 评论:0 推荐:


//schemaTable将取到所有用户表的信息,schemaTable取到指定表名的表的所有信息
OleDbConnection conn = new OleDbConnection(strConn);
   conn.Open();
   DataTable schemaTable  = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new Object[]{null, null, null, "table"});
DataTable schemaTable2  = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, new Object[]{null, null, /*tablename*/, null});
conn.Close();

 

本文地址:http://com.8s8s.com/it/it42735.htm