error with .dbf files
-
Hi,
I want to put an excel file in a table. I use this code: `Dim archivo As String = openFileDialog1.FileName FileDirectory = System.IO.Path.GetDirectoryName(archivo) FileName = System.IO.Path.GetFileName(archivo) DBFConnection = New Odbc.OdbcConnection("Driver={Microsoft dBASE Driver (*.dbf)};Dbq=" + FileDirectory + ";") DBFConnection.Open() Dim dr As New System.Data.Odbc.OdbcCommand("SELECT * FROM " + filename, DBFConnection) Dim dt As New Data.Odbc.OdbcDataAdapter(dr) Dim t As New Data.DataTable dt.Fill(t)` but I get the error : `ERROR [42S02] [Microsoft][ODBC dBase Driver] The Microsoft Jet database engine could not find the object 'A12_BLANK'. Make sure the object exists and that you spell its name and the path name correctly.` please help. thanks.
-
Hi,
I want to put an excel file in a table. I use this code: `Dim archivo As String = openFileDialog1.FileName FileDirectory = System.IO.Path.GetDirectoryName(archivo) FileName = System.IO.Path.GetFileName(archivo) DBFConnection = New Odbc.OdbcConnection("Driver={Microsoft dBASE Driver (*.dbf)};Dbq=" + FileDirectory + ";") DBFConnection.Open() Dim dr As New System.Data.Odbc.OdbcCommand("SELECT * FROM " + filename, DBFConnection) Dim dt As New Data.Odbc.OdbcDataAdapter(dr) Dim t As New Data.DataTable dt.Fill(t)` but I get the error : `ERROR [42S02] [Microsoft][ODBC dBase Driver] The Microsoft Jet database engine could not find the object 'A12_BLANK'. Make sure the object exists and that you spell its name and the path name correctly.` please help. thanks.
Surely if the database is a file, your connection string needs the file path, not just the directory path ? It would help to tell us how A12_BLANK fits into the picture, is it a directory name ? A file name ? Something unknown ?
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
Surely if the database is a file, your connection string needs the file path, not just the directory path ? It would help to tell us how A12_BLANK fits into the picture, is it a directory name ? A file name ? Something unknown ?
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
The problem is that I can connect to my database but I can't get the information from the file. The file A12_BLANK (the name of the file I want to insert in a table) is a excel file. thanks. -- modified at 8:43 Tuesday 11th September, 2007
-
Hi,
I want to put an excel file in a table. I use this code: `Dim archivo As String = openFileDialog1.FileName FileDirectory = System.IO.Path.GetDirectoryName(archivo) FileName = System.IO.Path.GetFileName(archivo) DBFConnection = New Odbc.OdbcConnection("Driver={Microsoft dBASE Driver (*.dbf)};Dbq=" + FileDirectory + ";") DBFConnection.Open() Dim dr As New System.Data.Odbc.OdbcCommand("SELECT * FROM " + filename, DBFConnection) Dim dt As New Data.Odbc.OdbcDataAdapter(dr) Dim t As New Data.DataTable dt.Fill(t)` but I get the error : `ERROR [42S02] [Microsoft][ODBC dBase Driver] The Microsoft Jet database engine could not find the object 'A12_BLANK'. Make sure the object exists and that you spell its name and the path name correctly.` please help. thanks.
your code:
DBFConnection = New Odbc.OdbcConnection("Driver={Microsoft dBASE Driver (*.dbf)};Dbq=" + FileDirectory + ";")
maybe better:DBFConnection = New Odbc.OdbcConnection("Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=" + FileDirectory + ";")
please don´t ask me why driferid = 790, i didn´t try this code, found it with google. -
The problem is that I can connect to my database but I can't get the information from the file. The file A12_BLANK (the name of the file I want to insert in a table) is a excel file. thanks. -- modified at 8:43 Tuesday 11th September, 2007
So, you're code is written to open a DBASE file (hint: Connection String!), but you're trying to get it to open an Excel file?
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007 -
your code:
DBFConnection = New Odbc.OdbcConnection("Driver={Microsoft dBASE Driver (*.dbf)};Dbq=" + FileDirectory + ";")
maybe better:DBFConnection = New Odbc.OdbcConnection("Driver={Microsoft Excel Driver (*.xls)};DriverId=790;Dbq=" + FileDirectory + ";")
please don´t ask me why driferid = 790, i didn´t try this code, found it with google.it doesn't work. thanks .
-
it doesn't work. thanks .
did you use the complete filename for the excel file?