Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. error with .dbf files

error with .dbf files

Scheduled Pinned Locked Moved Visual Basic
helpdatabase
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    WhiteGirl23
    wrote on last edited by
    #1

    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.

    C T 2 Replies Last reply
    0
    • W WhiteGirl23

      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.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      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 )

      W 1 Reply Last reply
      0
      • C Christian Graus

        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 )

        W Offline
        W Offline
        WhiteGirl23
        wrote on last edited by
        #3

        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

        D 1 Reply Last reply
        0
        • W WhiteGirl23

          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.

          T Offline
          T Offline
          Thomas Krojer
          wrote on last edited by
          #4

          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.

          W 1 Reply Last reply
          0
          • W WhiteGirl23

            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

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • T Thomas Krojer

              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.

              W Offline
              W Offline
              WhiteGirl23
              wrote on last edited by
              #6

              it doesn't work. thanks .

              T 1 Reply Last reply
              0
              • W WhiteGirl23

                it doesn't work. thanks .

                T Offline
                T Offline
                Thomas Krojer
                wrote on last edited by
                #7

                did you use the complete filename for the excel file?

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups