Web Analytics Made Easy -
StatCounter VBScript: Can i update the database this way? - CodingForum

Announcement

Collapse
No announcement yet.

VBScript: Can i update the database this way?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • VBScript: Can i update the database this way?

    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 ?

  • #2
    Re: VBScript: Can i update the database this way?

    Try:

    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
    I am the luckiest man in the world

    Comment


    • #3
      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

      Comment

      Working...
      X