Frage

Ich brauche eine Liste der Tabellen in einer Visual Fox Pro-Datenbank zu erhalten. (7.0) Das ist, was ich tue .... aber es funktioniert nicht oder ich tue es nicht richtig ...

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)
{}
War es hilfreich?

Lösung

Ich schrieb vor kurzem eine Codegenerierung Anwendung für LINQ to VFP , die die Schemainformationen erhalten. Hier ist, wie ich das Schema bekam.

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();
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top