update DB from an onClick event

Results 1 to 2 of 2

Thread: update DB from an onClick event

  1. #1
    gzazJim Guest

    Default update DB from an onClick event

    Greetings folks,<BR><BR>I have an ASP page with buttons that let my users know whether or not an item is on backorder. The buttons&#039 values (Yes/No) are determined by simple "If" statements like these:<BR><BR>response.write "&#060;input type=button name=btnA"<BR> If oRS("OnBackorder") = "Yes" Then<BR> response.write " value=Yes"<BR> Else<BR> response.write " value=No" <BR> End If <BR> Response.write "&#062;&#060;/td&#062;&#060;/tr&#062;"<BR><BR><BR>My question is how can I allow my users to click this button to change the status of the given item in the database? ie; if the button is marked "Yes" (the item is on backorder) I wish to allow the user to change not only the value of the button on the page, but also change the information in the Access DB as well.<BR><BR>Here is the current code for the button(s):<BR><BR>sub btnA_OnClick()<BR> If btnA.value="No" Then<BR> btnA.value="Yes"<BR> ElseIF btnA.value="Yes" Then<BR> btnA.value="No"<BR> End If<BR>End sub<BR><BR>The above sub works fine for changing the value on the page, but obviously doesn&#039t do diddly for the database. :) As you can see from the above, I&#039m only concerned with IE here.<BR><BR>Unfortunately, I am apparently having a really brain-dead day, as I can&#039t seem to find a way to process/make a call to a SQL Update statement within the subroutine. I am recieving an "Object Required:Server" Error because I&#039m attempting to process the SQL/Command inside a subroutine (inside &#060;script language="VBScript"&#062; ... &#060;/script&#062; tags) rather than inbetween &#060;% ... %&#062; tags.<BR><BR>I&#039m sure I could handle this much more efficiently with a JavaScript "OnClick=..." event, but sadly I&#039m lost when it comes to JavaScript ASP statements. If anyone has any thoughts on how to execute an UPDATE statement from within a subroutine, the help would be appreciated (Like I said - I&#039m apparently brain-dead today) :) <BR><BR>Thanks in advance for your time, and any thoughts.<BR><BR>Jim

  2. #2
    gzazJim Guest

    Default RE: update DB from an onClick event


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts