Ok folks, I am trying to write a line of code in Classic ASP for a button that will trigger it to go to another page with a querystring variable. However I am having difficulties getting this to work.
Here is my code so far:
response.write "<td valign='top'><input type='button' name='cmdUpdateInfo' value='Update Info' tabindex='7' onclick='window.location=updatecustomer.asp?UpdateID=""'" & rs("ID") & "'""/></td>" & vbCrLf
When this line is processed I get the following error on my ASP processor:
Error Type:
(0x80020009)
Exception occurred.
/ls_internal/newinvoice.asp, line 325
line 325 is the line of code above. I know this is something simple, but for the life of me, I cannot seem to figure it out.
Thank you in advance.
As you’ve currently written your line of code it will translate into
Assuming that the rs(“id”) contains the value 999. There is nothing wrong with that line of code, first thing I would try doing is comment out the rs(“id”) element and see if the page runs ok.
If it doesn’t then I would check further up your page – are you sure that your SQL query is returning anything? I wonder if your rs is empty (not a NULL value, I mean no records were returned) In which case you need to add an
IF NOT rs.eof THENcondition to your code.Personally I would follow Gaby aka G.Petrioli’s recommendation above to convert your HTML attributes into double quotes, and JavaScript to single.