Results 1 to 5 of 5

Thread: [RESOLVED] Connection string for dbase files

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Resolved [RESOLVED] Connection string for dbase files

    I have code below, How I can connect the dbase files (Microsoft visual pro) using ADODB connection? I got the code below but it use microsoft access to connect the database.

    Code:
    Dim strDB, strConn As String
         'Set New connection
        Set cnnACC = New ADODB.Connection
         'String Database Path
        strDB = TextBox1.Text
        strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDB & ";Persist Security Info=False"
         ' Open the connection
        cnnACC.Open strConn

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Connection string for dbase files

    Here's what I found

    Code:
     	
    DBase ODBC Connection String
    Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=c:\directory;
    DBase OLEDB Connection String
    Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\directory;Extended Properties=dBASE IV;User ID=Admin;Password=

  3. #3
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Connection string for dbase files

    matrik02: You should bookmark this site:

    http://www.connectionstrings.com

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2007
    Location
    Malaysia
    Posts
    1,370

    Re: Connection string for dbase files

    Why I got that error message? It point me at this line
    rst.Open sSQL, cnnACC, adOpenDynamic, adLockOptimistic

    My dbf files location is here

    D:\Sourcecode\Add table from dbase\table.dbf

    Code:
       Dim strConn As String
        Dim sSQL As String
         'Set New connection
        Set cnnACC = New ADODB.Connection
        Set rst = New ADODB.RecordSet
        strConn = "Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=D:\Sourcecode\Add table from dbase;"
        cnnACC.Open strConn
        
        
        sSQL = "SELECT * FROM table"
        rst.Open sSQL, cnnACC, adOpenDynamic, adLockOptimistic
    Attached Images Attached Images  

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Connection string for dbase files

    Is your database name "Add table from dbase" with no file extension?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width