#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2003
    Posts
    66
    Rep Power
    11

    query syntax error


    hi i have to query the database nut keep getting a syntax in my query error, however the query works fine when trying in microsoft access. the query is

    databaseCommand = "4"
    Dim db As New ADODB.Connection
    Dim rec As New ADODB.Recordset
    Dim query As String
    db.ConnectionString = "Data Source=hover;"
    db.Open
    Dim parameter As String
    query = "SELECT Passengers,Cars From RouteSchedule WHERE ((CInt(RouteSchedule.RouteNos)='" & CInt(Parser(1)) & "' AND WHERE (CStr(RouteSchedule.Day)='" & CStr(Parser(2)) & "' AND WHERE (((RouteSchedule.DepTime)='" & CStr(Parser(3)) & "')));"
    rec.Open query, db
    rec.MoveFirst
    WS.SendData databaseCommand & "," & rec.Fields(CStr("Passengers")).Value & (",") & rec.Fields(CStr("Cars")).Value
    db.Close

    the result states that there is an error in the syntax but is not specific any help is welcome.
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,118
    Rep Power
    4274
    do yourself a favour, do not cross-post the same question into multiple forums, you will only annoy people that way, and reduce the chances of getting an answer

    this Access question has been answered in the MySQL forum
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

IMN logo majestic logo threadwatch logo seochat tools logo