help regarding error to ODBC connection!!

Sep 21 2004 10:50 PM
Hi I am using text file as database and using the following code for accessing it but I am getting an error at a particular line which is: An unhandled exception of type 'Microsoft.Data.Odbc.OdbcException' occurred in microsoft.data.odbc.dll CODE: // Connection string for a Text file string ConnectionString = @"Driver={Microsoft Text Driver (*.txt; *.csv)};DBQ=E:\Documents and Settings\Administrator\My Documents\Visual Studio Projects\Tab_menu_trial\Music_Catalogue_Table.txt"; // Query the Employees.txt file as a table OdbcConnection conn = new OdbcConnection(ConnectionString); conn.Open(); OdbcDataAdapter da = new OdbcDataAdapter("Select * FROM Music_Catalogue_Table",conn); - THIS IS THE LINE WHERE I AM GETTING ERROR DataSet ds = new DataSet(); //fill the data set object da.Fill(ds, "Music_Catalogue_Table"); //Get one table from the DataSet DataTable dataTable = ds.Tables[0]; //for each row in the table, display the info foreach(DataRow dataRow in dataTable.Rows) { lbSong.Items.Add(dataRow["Song_Name"]); } // Close the connection conn.Close(); I will appreciate if anybody can help me with that.

Answers (1)