Solved

SQL Update statement in ASP page

Posted on 2007-11-19
4
1,305 Views
Last Modified: 2012-06-21
I'm currently trying to update a small database using a sql statement on an asp page.  The line of code reads as follows:

"UPDATE tbl_Personal SET Email="request.form("email")" WHERE Username="request.cookies("MyCookie")("Username")""

This gives the error "expected end of statement".  I'm guessing it's a syntax error as if I replace the line with the following:

"UPDATE tbl_Personal SET Email='a@a.com' WHERE Username='John'"

...it works as expected and updates the record.  I've tried various syntaxes and tried declaring the textbox value and cookie value as variables but I'm still stuck.  Hope someone can help!

Thanks
0
Comment
Question by:grunners80
  • 2
  • 2
4 Comments
 
LVL 16

Expert Comment

by:SQL_SERVER_DBA
Comment Utility

"UPDATE tbl_Personal SET Email= '" & request.form("email") & "' WHERE Username='" & TXTUsername.TEXT &"')"

Open in new window

0
 

Author Comment

by:grunners80
Comment Utility
Thanks, i'll give that a go.  Can I request a cookie value for the WHERE clause?
0
 
LVL 16

Accepted Solution

by:
SQL_SERVER_DBA earned 125 total points
Comment Utility
you can but, the syntax you had the statement in didn't make sense...just remember to put your variables in the correct format...like I did with email and username
0
 

Author Closing Comment

by:grunners80
Comment Utility
That worked a treat! Many thanks!
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This video discusses moving either the default database or any database to a new volume.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now