Error connecting to DBC bank

Asked

Viewed 94 times

1

I am trying to connect my program to a DBC database using the tutorial from this link:

http://rodrigolameira.blogspot.com.br/2009/08/conectando-banco-dbc-em-c.html

The code used is as follows::

string path = @"D:\tabwin\";
string cs = "Driver={Microsoft Visual FoxPro Driver};SourceType=DBC;SourceDB=" + path + "PAPE1701.dbc;Exclusive=No; NULL=NO;Collate=Machine;BACKGROUNDFETCH=NO;DELETED=NO;";
OdbcConnection conn = new OdbcConnection(cs);
conn.Open(); //<<< LINHA COM ERRO
string sql = @"SELECT * FROM pape1701";
OdbcCommand cmd = new OdbcCommand(sql, conn);
OdbcDataAdapter da = new OdbcDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
dataGridView1.DataSource = ds;
//dataGridView1.DataBind();
conn.Close();

When running the program, I get the following error:

System.Data.Odbc.Odbcexception: ERROR [IM002] [Microsoft][ODBC Driver Manager] Name of data source not found and no default driver specified

How to correct?

  • 1

    Have you checked the data source Microsoft Visual FoxPro Driver is installed on your machine? Use the Windows ODBC Data Source Administrator to see this.

  • I gave up, decided to do the system in Delphi

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.