Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql where clause not working 1

Status
Not open for further replies.

craiogram

MIS
Feb 20, 2004
126
US
Can somebody please assist me with this sql. I can't seem to get the WHERE clause to work for me.
Thank you in advance.

Code:
sl = Request.Form("recID")

sql = "UPDATE AdviceDataStore SET SeekerName ='"&Request.Form("SeekerNametxt")&"',"&_
	  "SeekerDataEntry = '"&Request.Form("SeekerDataEntrytxt")&"',"&_
	  "Advice = '"&Request.Form("CherryzAdvicetxt")&"' WHERE ID="&sl

I've also tried
Code:
sl = Request.Form("recID")

sql = "UPDATE AdviceDataStore SET SeekerName ='"&Request.Form("SeekerNametxt")&"',"&_
	  "SeekerDataEntry = '"&Request.Form("SeekerDataEntrytxt")&"',"&_
	  "Advice = '"&Request.Form("CherryzAdvicetxt")&"'"
	  "WHERE ID="&sl

but neither works for me. I get "Expected statement" Error??
 
Hi,
To aid in debugging set a variable:
SqlCode = '"&Request.Form("SeekerNametxt")&"',"&_
"SeekerDataEntry = '"&Request.Form("SeekerDataEntrytxt")&"',"&_
"Advice = '"&Request.Form("CherryzAdvicetxt")&"'"
"WHERE ID="&sl

and use a Response.Write(SqlCode) to see what is actually being sent to the database.



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
If you're getting an error, you'll also need to follow the response.write() with a response.flush() so you'll be able to see your write.
 
is your variable sl an integer or string...

if its a string..try this:
Code:
sl = Request.Form("recID")

sql = "UPDATE AdviceDataStore SET SeekerName ='"&Request.Form("SeekerNametxt")&"',"&_
      "SeekerDataEntry = '"&Request.Form("SeekerDataEntrytxt")&"',"&_
      "Advice = '"&Request.Form("CherryzAdvicetxt")&"' WHERE ID='"&sl&"' "

also response.write sql is the way to debug...i think you are getting a empty form variable...

-DNG
 
Thank you guys. I can only assume that it was something about how I was using the ticks and quotes because when I put all the request.form("formfield") into variables and used the variables in the sql it worked fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top