Results 1 to 3 of 3
  1. #1
    Join Date
    May 2006
    Posts
    2

    Unhappy SQL Query From VB.Net on FoxPro *.DBF Files

    Hi,
    I have problem with query that have the following syntax,

    Dim sQuery As String
    sQuery = "SELECT patreq.accno,patreq.lname,patreq.FName,patreq.DOB, patreq.Sex FROM indtest, pattest, patreq WHERE indtest.testno = pattest.testno AND pattest.accno = patreq.accno AND (indtest.inhouse = 'Q') And (patreq.AccDate Between {" + Me.dtpStartingDate.Text.Trim + "} And {" + Me.dtpToAccDate.Text.Trim + "})"

    when i pass it to the ODBCDataAdapter and called on Fill method, it give the error message as follows;

    "ERROR [42000] [Microsoft][ODBC dBase Driver] Syntax error in query expression 'indtest.testno = pattest.testno AND pattest.accno = patreq.accno AND (indtest.inhouse = 'Q') And (patreq.AccDate Between 11/20/2005} And 1/20/2006})'."

    Note that { braces have been omitted around the dates. Also Note that i am using odbcdatadapter with connection string
    "Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=f:\lab;"

    Thanks for your great solution. I'll wait in hope of correct solution.

  2. #2
    Join Date
    May 2006
    Posts
    1
    Hi Maqbool.

    Not too clued up on Foxpro but I'll make a humble attempt -

    Does the db support the date in that format (/)? What about putting quotes around the date ?

  3. #3
    Join Date
    May 2006
    Posts
    2

    Exclamation Fox 2.6 support date in within {}

    Hi Shakk,
    Thanx for kind information. As you asked about double qoutes but that is not supported by Fox 2.6. The driver I am using seems to making problem with me. I have used OleDb that works correct but thats performance is not good.
    { brackets may be used by the driver as special characters. If U get solution plz response me. Thanx

    Quote Originally Posted by shakk
    Hi Maqbool.

    Not too clued up on Foxpro but I'll make a humble attempt -

    Does the db support the date in that format (/)? What about putting quotes around the date ?

Posting Permissions

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