By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,868 Members | 1,974 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,868 IT Pros & Developers. It's quick & easy.

How to put a variable copy in update query

P: 3
can i ask how can i put a variable copy in update query

if i write this give me a wrong:
Expand|Select|Wrap|Line Numbers
  1. sql="UPDATE book_info SET num_copies="copy" "+
  2. " where num="+Request.form("No_book");
  3. abCon.Execute(sql);
  4.  RS.colse; 
  5.  DbCon.close; 
  6. %>
Mar 4 '13 #1
Share this Question
Share on Google+
1 Reply

P: 298
to fix the syntax error in the sql statement, try:
Expand|Select|Wrap|Line Numbers
  1. sql = "UPDATE book_info SET num_copies=" + copy + " where num=" + Request.Form("No_book")
but Request.Form directly in your statement might open your database for SQL injection attacks if this is open to public up on it
Mar 20 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.