Response.write sqlStr

Does the sql statement look valid to you?

As was mentioned earlier, anytime you place a string within 'quotes', make
sure there aren't any 'quotes' in the string:

Example if someone entered "here's my comment" in the Comments field of your
form:


update NWISUpdate set RequestStatus = 'Complete',
Comments = 'here's my comment'  <==== error on this line
where ID='2'

To avoid this:

         replace(request.form("Comments"),"'","''")

HTH

-----Original Message-----
From: Hohimer, Christopher J [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 12, 2002 2:47 PM
To: ActiveServerPages
Subject: help with an error


Can someone help me with an SQL error?
I get the following error:
Microsoft VBScript compilation error '800a0400'

Expected statement

When using this code:

set UpdateConn = Server.CreateObject("ADODB.Connection")

MdbFilePath = Server.MapPath("NWIS.mdb")

UpdateConn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" &
MdbFilePath & ";"

sqlstr = "update NWISUpdate set RequestStatus = 'Complete', Comments = '" &
request.form("Comments") & "' where ID='" & request.form("id") & "'"

UpdateConn.Execute(sqlstr)

UpdateConn.Close

set UpdateConn = nothing


any help is appreciated. Thanks!


---
You are currently subscribed to activeserverpages as:
[EMAIL PROTECTED]
To unsubscribe send a blank email to
%%email.unsub%%


---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to