Results 1 to 4 of 4
  1. #1
    Join Date
    May 2002
    Location
    Hyderabad
    Posts
    3

    Unanswered: Accessing dBase database in Visual Basic

    I have a .dbf file,i want to access that file using Visual Basic 6.0.How to do this in vb can someone give a example for this.

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346

    Re: Accessing dBase database in Visual Basic

    Dim cn as ADODB.Connection
    Dim rs as ADODB.Recordset

    Set cn = new ADODB.Connection

    cn.ConnectionString = "Driver={Microsoft dBASE Driver (*.dbf)};" & _
    "DriverID=277;" & _
    "Dbq=c:\somepath"

    cn.open

    set rs = new ADODB.recordset

    rs.ActiveConnection = cn

    'Then specify the filename in the SQL statement:
    rs.Open "Select * From user.dbf", oConn, , ,adCmdText

    rs.Close

    cn.Close

    Set rs=Nothing
    Set cn = Nothing
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

  3. #3
    Join Date
    Mar 2004
    Location
    Philippines
    Posts
    1

    Please Help me :(

    [QUOTE=SCIROCCO]Dim cn as ADODB.Connection
    Dim rs as ADODB.Recordset

    Set cn = new ADODB.Connection

    cn.ConnectionString = "Driver={Microsoft dBASE Driver (*.dbf)};" & _
    "DriverID=277;" & _
    "Dbq=c:\somepath"

    cn.open

    set rs = new ADODB.recordset

    rs.ActiveConnection = cn

    'Then specify the filename in the SQL statement:
    rs.Open "Select * From user.dbf", oConn, , ,adCmdText

    rs.Close

    cn.Close

    Set rs=Nothing
    Set cn = Nothing

    i tried this code but it gives me an error of 3001: "arguments are of the wrong type, are out of acceptable range, or are in conflict with one another"... i hope anyone could help me....tnx

  4. #4
    Join Date
    May 2004
    Posts
    1
    check out this out, this line should appear to correct the problem man...

    'Then specify the filename in the SQL statement:
    rs.Open "Select * From bartran.dbf", cn, , , adCmdText

Posting Permissions

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