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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Executing Multiple SQL statments 1

Status
Not open for further replies.

RTDesi

MIS
Apr 17, 2001
24
US
Here's the problem:

On one page I have a form with multiple checkboxes that allows the user to select various different categories to which they want to send their information . For each category, I have a separate table in the database. What I want to do is be able to check to see which checkboxes are checked, and insert the form data into the database to each category (hence each table) that is selected. All the checkboxes have different names (not an array of checkboxes). What I currently have is an if/then statement for each checkbox :

if Request.Form("checkbox_financial")=true then
sSQL = "insert into FINANCIAL (NAME, SUBJECT, DESCRIPTION) values ('" & nm & "','" & subject & "','" & desc & "');"
oConn.Execute sSQL
end if

if Request.Form("checkbox_manufacturing")=true then
sSQL = "insert into MANUFACTURING (NAME, SUBJECT, DESCRIPTION) values ('" & nm & "','" & subject & "','" & desc & "');"
oConn.Execute sSQL
end if

set oConn= Nothing

...and various other statements like this for each category

BUT, this isnt working. I dont know where to execute the SQL,or where to end the connection. Also, since all the SQL statements are 'sSQL', would each successive SQL statement overwrite the preceeding one? Any information on this would be greatly appreciated. Thanks in advance.
 
It looks good, but I have trouble evaluating a request.form("value") to a boolean expression -- because they come in as strings --

Try setting the "value" attribute of each of your checkboxes to "1" and then asking

if request.form("elementName") = "1" then
'blahblahblah
end if

Other than that, I think your logic is airtight, so it should work.

:)
Paul Prewett
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top