?
Solved

sql noob question

Posted on 2007-10-04
2
Medium Priority
?
175 Views
Last Modified: 2010-03-20
Can someone tell me what I've done wrong here?  There is something wrong with my where clause.  If i write the value in idnumber manually everything works fine.  But when i try to assign it as a variable it won't work.

<%
sql ="UPDATE bc SET bc_approved = 1, bc_name='"&name&"', bc_title='"&title&"', bc_address1='"&address&"', bc_address2='"&address2&"', bc_cell='"&direct&"',bc_phone2='"&tollfree&"',bc_phone='"&office&"',bc_fax='"&fax&"',bc_license='"&lic&"',bc_email='"&email&"',bc_spanish='"&spanish&"',bc_quantity='"&quantity&"',bc_backer='"&backer&"' WHERE bc_id = '"&idnumber&"'"
%>
0
Comment
Question by:imjusthere
2 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 1000 total points
ID: 20018390
If id is numeric, omit the single quotes:

sql ="UPDATE bc SET bc_approved = 1, bc_name='"&name&"', bc_title='"&title&"', bc_address1='"&address&"', bc_address2='"&address2&"', bc_cell='"&direct&"',bc_phone2='"&tollfree&"',bc_phone='"&office&"',bc_fax='"&fax&"',bc_license='"&lic&"',bc_email='"&email&"',bc_spanish='"&spanish&"',bc_quantity='"&quantity&"',bc_backer='"&backer&"' WHERE bc_id = "&idnumber
0
 
LVL 25

Expert Comment

by:kevp75
ID: 20018582
that actually shouldn't matter (though I realize that sometimes it does....)

probably should make sure the value is actually populated by something...

response.write(idnumber)

while you're at it, you could also convert it to an integer

cint(idnumber)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Recursive SQL is one of the most fascinating and powerful and yet dangerous feature offered in many modern databases today using a Common Table Expression (CTE) first introduced in the ANSI SQL 99 standard. The first implementations of CTE began ap…
This shares a stored procedure to retrieve permissions for a given user on the current database or across all databases on a server.
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

850 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