Connect to dBase with C#

Apr 8 2006 5:13 PM
Over the past few days I have been working on an application that iterates through dBase files and outputs the information in a listbox or datagrid. I seem to have gotten the connection string right as I don't get an error when I open the dbf file, but, whenever I add in the DataAdapter and DataSet I get an error. It might help to know that I am using VS .NET 2005 and I am trying to connect to the dBase files using ODBC. Below is the code I am using and an image of the error I get. Code: OdbcConnection conn = new OdbcConnection(); conn.ConnectionString = ("Driver={Microsoft dBASE Driver (*.dbf)};DriverID=21;Dbq=I:\\MDT_1.4\\;"); try { // Open Drawing Database conn.Open(); // Query string jobData = "SELECT DWG_NAME, DWG_NUMBER FROM DRAWINGS.dbf"; OdbcCommand cmd = new OdbcCommand(); cmd.CommandText = (jobData); OdbcDataAdapter dbAdapter = new OdbcDataAdapter(jobData, conn); //<---Error begins here (I think) DataSet dtSet = new DataSet(); dbAdapter.Fill(dtSet); DataTable dbTable = dtSet.Tables[0]; foreach (DataRow dbRow in dbTable.Rows) { outputListBox.Items.Add(dbRow["DWG_NAME"].ToString()); }