因为特殊需要,需要获取dbf数据库中的表的名称。现有 如下解决办法
1 public List<string> GetTableFields(string path) 2 { 3 List<string> tables = new List<string>(); 4 var dt = GetSchemaTable(ConnectionString); 5 foreach (DataRow dr in dt.Rows) 6 { 7 tables.Add(dr["COLUMN_NAME"] as string); 8 } 9 return tables; 10 } 11 12 private DataTable GetSchemaTable(string connectionString) 13 { 14 using (OleDbConnection connection = new 15 OleDbConnection(connectionString)) 16 { 17 connection.Open(); 18 DataTable schemaTable = connection.GetOleDbSchemaTable( 19 OleDbSchemaGuid.Columns, 20 new object[] { null, null, null, null }); 21 return schemaTable; 22 } 23 }