Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2003
    Posts
    2

    Unanswered: AAccessing DBF files with Jet 4.0

    I'm writing a VB application where I'm trying to access a number of DBF files using Jet 4.0. Using the following code I can access the data.

    Dim objCon As ADODB.Connection
    Dim objCom As ADODB.Command
    Dim objRS As ADODB.Recordset

    Set objCon = New ADODB.Connection
    Set objCom = New ADODB.Command


    'Open connection
    objCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Extended Properties=dBASE IV;" & _
    "Data Source=c:\MDW2;"

    objCon.Open objCon.ConnectionString


    'get record set
    Set objRS = New ADODB.Recordset


    'Run multi select statment
    objRS.Open "SELECT * From Patients", objCon, adOpenStatic, adLockReadOnly, adCmdText


    If objRS.RecordCount > 0 Then
    objRS.MoveLast
    End If

    The above code works

    However if I replace the recordset statement with * with a specific field name eg. surname

    objRS.Open "SELECT surname From Patients", objCon, adOpenStatic, adLockReadOnly, adCmdText

    This cause an error

    No value given for one or more required paramters

    Does anybody know how to get this working?

    TIA

    Grant

  2. #2
    Join Date
    Mar 2003
    Location
    Atlanta, GA
    Posts
    191

    Re: AAccessing DBF files with Jet 4.0

    Originally posted by gamcp
    I'm writing a VB application where I'm trying to access a number of DBF files using Jet 4.0. Using the following code I can access the data.

    Dim objCon As ADODB.Connection
    Dim objCom As ADODB.Command
    Dim objRS As ADODB.Recordset

    Set objCon = New ADODB.Connection
    Set objCom = New ADODB.Command


    'Open connection
    objCon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Extended Properties=dBASE IV;" & _
    "Data Source=c:\MDW2;"

    objCon.Open objCon.ConnectionString


    'get record set
    Set objRS = New ADODB.Recordset


    'Run multi select statment
    objRS.Open "SELECT * From Patients", objCon, adOpenStatic, adLockReadOnly, adCmdText


    If objRS.RecordCount > 0 Then
    objRS.MoveLast
    End If

    The above code works

    However if I replace the recordset statement with * with a specific field name eg. surname

    objRS.Open "SELECT surname From Patients", objCon, adOpenStatic, adLockReadOnly, adCmdText

    This cause an error

    No value given for one or more required paramters

    Does anybody know how to get this working?

    TIA

    Grant

    I've never used a provider statement for dbase or foxpro access... I've always set up a DSN on the server, and then used the dsn to connect. I've never had any problems this way.

    Tim
    Tim

Posting Permissions

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