Hi, I'm working with VB.NET and MS Access XP. I've been given a database and, I'm unfamiliar with it's format. It appears to be a "linked database" or a database with "linked tables" (terminology?). The name of the db is "kilopost.dbf". When I open it and view the table it contains (named "kilopost"), a new database file named "kilopost1.mdb" is created which, contains the same information as the "kilopost.dbf". This will repeat as many times as I view the table apparently (kilopost2.mdb, kilopost3.mdb, kilopost4.mdb... etc. will be created). Each one of those files contains a table named "kilopost" which is linked to "kilopost.dbf".
Anyway, my problem is that I'm trying to read from this database using vb.net's "OleDbDataReader". I have no problem reading from my other .mdb files. Here is the error message produced when I try to access the kilopost database:
The database does exist and the name and path are correct. I am successfully connecting to and reading from another .mdb in the same app.VB Code:
System.Data.OleDb.OleDbException: The Microsoft Jet database engine cannot find the input table or query 'kilopost'. Make sure it exists and that its name is spelled correctly. at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32 hr) at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult) at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method) at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior) at CT_CPT_DB.Form1.btnPopLists_Click_1(Object sender, EventArgs e) in C:\Documents and Settings\Paul\My Documents\Work\VS_Proj\VB\Create_CPT_DB\CT_CPT_DB\Form1.vb:line 685
Here's a snippet of code:
VB Code:
Dim strSQL1 As String Dim strSQL2 As String Dim strSQL3 As String strSQL1 = "SELECT * FROM cty_rte_pm_ea" strSQL2 = "SELECT * FROM kilopost" Dim cmdCptMetaData As New OleDbCommand(strSQL1, odbConnCptMetaData) Dim cmdKilopost As New OleDbCommand(strSQL2, odbConnKilopost) odbConnCptMetaData.Open() odbConnKilopost.Open() Try Dim cptMetaDataReader As OleDbDataReader = _ cmdCptMetaData.ExecuteReader(CommandBehavior.CloseConnection) Dim cptKilopost_Reader As OleDbDataReader = _ cmdKilopost.ExecuteReader(CommandBehavior.CloseConnection)
Thanks for your help!
Paul




Reply With Quote