I am using getschema and simply trying to get names of tables within database data1.dbc. I have looked at the returned schmema info with the debugger and with the following code and can't see table names (which I know are in database). Have I used GetSchema correctly or am I not looking in the right place? Thanks!

string strCon = @"Provider=VFPOLEDB;Data Source=c:\users\me\My Documents\data1.dbc"; // this dbc exists
            OleDbConnection cn = new OleDbConnection(strCon);

            // Open Connection

            //DataTable schemaInfo = cn.GetSchema(); // available schemas
            //foreach (DataRow row in schemaInfo.Rows)
            //   string schema = (string)row[0];

            //   DataTable t = cn.GetSchema(schema);
            //   Form f = new ShowDataForm(t, schema);
            //   f.ShowDialog();

public class ShowDataForm : Form
    public ShowDataForm(DataTable tbl, string caption)
        this.dgv = new System.Windows.Forms.DataGridView();
        this.dgv.Location = new System.Drawing.Point(0, 0);
        this.dgv.Dock = DockStyle.Fill;
        this.dgv.DataSource = tbl;
        this.Text = caption;
        this.ClientSize = new System.Drawing.Size(1024, 768);
    private System.Windows.Forms.DataGridView dgv;
7 Years
Discussion Span
Last Post by lolafuertes

When you cn.GetSchema() you are retrieving the metadata info, not the tables info. The metadata info will give you the collection names you can retrieve using cm.GetSchema(CollectionName). You must enumerate the results in order to obtain the specific collection name for the tables info.

Please read here and there for the GetSchema() common and specifics.

Hope this helps.

Edited by lolafuertes: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.