0

我需要获取 Visual Fox Pro 数据库中的表列表。(7.0)这就是我正在做的......但它不起作用或者我做的不对......

DataFactory dataFactory = new DataFactory();

dataFactory.CreateOldStarbaseConnection();
dataFactory.OpenOldStarbaseConnection();
OleDbConnection oldStarbaseConnection = dataFactory.OldStarbaseConnection;

object[] arrRestrict = new object[] { null, null, "NewStarbase", null };

// Get the tables in the new Database
DataTable tblDbSchema = newStarbaseConnection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, arrRestrict);

// for each table in the new database
foreach (DataRow myDataRow in tblDbSchema.Rows)
{}
4

1 回答 1

6

我最近为获取架构信息的LINQ to VFP编写了一个代码生成应用程序。这是我获得架构的方式。

using (OleDbConnection conn = new OleDbConnection(connectionString)) {
    conn.Open();
    DataTable tables = conn.GetSchema("Tables");
    DataTable columns = conn.GetSchema("Columns");
    DataTable dt = conn.GetSchema("Indexes");
    conn.Close();
}
于 2010-01-14T14:55:54.050 回答