View Full Version : VBScript: Can i update the database this way?

03-03-2004, 09:24 AM
Hi, Im doing VBScript and Im trying to update the Access DB.

I have a table Quota and I want to update it with the following information.

set rs = conn.execute("select * from Quota")

dim x = rs("quota") <----A
dim y = Request.Form("po_amt") <----B

dim quotaLeft = x - y

conn.execute("update Quota set quota = "& quotaLeft &"")

Request.Form is what the user had entered.

But i keep getting a compilation error :"Expected End Of Statement" for both of the declared statements A & B

How am I supposed to declare them? I need the information to update the table. Is there any other way? or This cannot be done?

Plss...help ? :(

03-03-2004, 10:58 AM

dim x,y,quotaLeft
x = rs("quota")
y = Request.Form("po_amt")
quotaLeft = x - y

in asp, you cannot dimension and assign a value to a variable in one statement

03-04-2004, 01:01 AM
Hey thanks, That does the trick...Simple solution actually, I should had thought of trying that out first...But i didnt cos I could do that in Java so i assumed that it was possible across all languages...Guess my ASP knowledge is still not very good haha...

Anyways, THANKS :thumbsup: