Solved

SQL Update statement in ASP page

Posted on 2007-11-19
4
1,307 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
ID: 20314429

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

Open in new window

0
 

Author Comment

by:grunners80
ID: 20314669
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
ID: 20314743
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
ID: 31409993
That worked a treat! Many thanks!
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

810 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