Re: ASP Problem

by "Steve Cost" <scost(at)neo.rr.com>

 Date:  Thu, 10 May 2001 23:07:53 -0400
 To:  "Jason Berhalter" <berh1571(at)fredonia.edu>,
<hwg-languages(at)hwg.org>
 References:  fredonia
  todo: View Thread, Original
Try assigning the value of Request("whatever") to a
variable, then use the variable in your Select statement.
Does away with some single and double quote problems within
the Select statement. HTH.
Steve

----- Original Message -----
From: "Jason Berhalter" <berh1571(at)fredonia.edu>
To: <hwg-languages(at)hwg.org>
Sent: Thursday, May 10, 2001 10:16 PM
Subject: ASP Problem


Hello. I am writing a front end for a database and I am
trying to set up a
page that deletes records, here is my code:

<%
dim objConn, objRec, strLook, sqlLook

set objConn = server.CreateObject("ADODB.Connection")

' DSNless connection to Access Database
  dim strConnect

strConnect="DRIVER={Microsoft Access Driver (*.mdb)}; "
strConnect=strConnect & "DBQ=" &
server.mappath("/database/problems.mdb")

'objConn.Mode = adModeReadWrite '3
objConn.Open strConnect

'Check to delete

if request("IP_Address") <> "" and request("Host_Name") <>
"" and
request("Host_Name") <> "" then

 dim strDelete

 strDelete = "DELETE FROM tblGetProbInfo WHERE IP Address='"
&
request("IP_Address") & "' AND Host Name='" &
request("Host_Name") & "' AND
BrowserOS='" & request("Browser_Info") & "' AND DateTime='"
&
request("Date_Time") & "' AND Email='" &
request("email_address") & "' AND
URL='" & request("URL") & "' AND ProbDescription='" &
request("comments") &
"'"

 objConn.Execute strDelete

 response.write "<BR> The Entry Has Been Removed <BR>"

end if
%>
--------------------------------------
I recieve the following error when I try to delete a record:

Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

[Microsoft][ODBC Microsoft Access Driver] Syntax error
(missing operator) in
query expression 'IP Address='.....

/test.asp, line 28
-------------------------------------------

Also, line 28 in my code is this: objConn.Execute strDelete

Any ideas what could be wrong?

-Jason Berhalter

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA