Faulty SQL Statement? HELP!!!!

Results 1 to 2 of 2

Thread: Faulty SQL Statement? HELP!!!!

  1. #1
    Phil Robbins Guest

    Default Faulty SQL Statement? HELP!!!!

    I&#039d appreciate all the help I can get on this. I believe I have a faulty sql statement. The first piece of code is what I have plugged into my asp script. When I try and perform a query using this code I get a 80040e14 error:<BR><BR>----------------------------------------------------------<BR>HERE&#039S THE PIECE OF CODE<BR>----------------------------------------------------------<BR><BR>&#060;%<BR><BR>varBusRouteID= request.form("BusRouteID")<BR>dim ORSp<BR>Set oRSp=server.createobject("ADODB.recordset")<BR>sql text= "SELECT tbllandmarks.Landmark, tblroutes.BusRouteID, tblroutes.PocketSchedule, tblroutes.ADARoute FROM tbllandmarks INNER JOIN tblroutes ON tbllandmarks.ID = tblroutes.LandmarkID _"<BR>sqltext=sqqltext& " WHERE (((tbllandmarks.Landmark)=& varBusRouteID & ))";"<BR>oRSp.open sqltext, "dsn=landsearch"<BR><BR>%&#062;<BR><BR><BR>--------------------<BR><BR>The below code is what works very well in ACCESS 97:<BR><BR>SELECT tbllandmarks.Landmark, tblroutes.BusRouteID, tblroutes.PocketSchedule, tblroutes.ADARoute<BR>FROM tbllandmarks INNER JOIN tblroutes ON tbllandmarks.ID = tblroutes.LandmarkID<BR>WHERE (((tbllandmarks.Landmark)=[Enter the Landmark you want to see]));<BR><BR>-----------------------------<BR><BR>I would appreciate any input as to how I should have the above query plugged into my asp script. Again, thank you for any/all input.<BR><BR>Sinc.<BR><BR>Phil Robbins<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Faulty SQL Statement? HELP!!!!

    Is varBusRouteID an asp variable ? <BR><BR>If so you need to escape from the sting to concatanate it with your where clause:<BR><BR>sqltext=sqqltext& " WHERE (((tbllandmarks.Landmark)= &#039" & varBusRouteID & "&#039))"<BR><BR>Also Take note of the single quotes and I don&#039t *think* you need the semi-colon at the end.

Posting Permissions

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