Update database without submit button (single page code) ASP

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Update database without submit button (single page code) ASP

    Please help.

    Trying to update a record using ASP but within a single page i.e. no
    submit button. Code below.

    Thanks in advance - ASP Novice!

    <%
    Dim objRS__MMColParam
    objRS__MMColParam = "1"
    If (Request.Form("cartId") <> "") Then
    objRS__MMColParam = Request.Form("cartId")
    End If
    %>

    <%
    Dim whichOne
    'here we are getting the number from the URL
    whichOne = Request.QueryString("Country")
    If whichOne = "GB" Then
    'if whichOne is one we do this

    Set objRS = Server.CreateObject("ADODB.Recordset")
    objRS.ActiveConnection = MM_INVITE_CON1_STRING
    objRS.Source = "SELECT * FROM tblSessions WHERE OrderRef = '" +
    Replace(objRS__MMColParam, "'", "''") + "'"
    objRS.CursorType = 0
    objRS.CursorLocation = 2
    objRS.LockType = 1
    objRS.Open()

    objRS_numRows = 0

    ' Now updating records
    objRS("PayName") = Request.QueryString("name")
    objRS.Update

    ElseIf whichOne = "US" Then
    'if whichOne is two we do this

    Set objRS = Server.CreateObject("ADODB.Recordset")
    objRS.ActiveConnection = MM_INVITE_CON1_STRING
    objRS.Source = "SELECT * FROM tblSessionsUS WHERE OrderRef = '" +
    Replace(objRS__MMColParam, "'", "''") + "'"
    objRS.CursorType = 0
    objRS.CursorLocation = 2
    objRS.LockType = 1
    objRS.Open()

    objRS_numRows = 0
    ElseIf whichOne = "CA" Then
    'if whichOne is three we do this

    Set objRS = Server.CreateObject("ADODB.Recordset")
    objRS.ActiveConnection = MM_INVITE_CON1_STRING
    objRS.Source = "SELECT * FROM tblSessionsCA WHERE OrderRef = '" +
    Replace(objRS__MMColParam, "'", "''") + "'"
    objRS.CursorType = 0
    objRS.CursorLocation = 2
    objRS.LockType = 1
    objRS.Open()

    objRS_numRows = 0
    Else
    'otherwise we tell them they did not make a choice
    Response.Write "You did not make a choice, go back and do so now."
    End If
    %>

    <%
    objRS.Close()
    Set objRS = Nothing
    %>
    Madge Guest

  2. Similar Questions and Discussions

    1. Single & Double Quote Problem in Database Insert/Update
      Hello, I have a textarea on a form where users are able to enter text wrapped in 'single' and "double" quotes. However, when I insert or update...
    2. Update multiple rows data with a single button
      hello I have been trying to run multiple update queries based on the data entered by user. Brief background: I am fetching data from various...
    3. what in the code makes a .gif a submit button
      How do I make a normal .gif into a submit button that will hold action? ie. <input type='submit' name='Submit' value='Submit'> when I put the src...
    4. html code to update web page
      Hi I am new to Macromedia Dreamweaver and also to html. I have html pages which link to files on our network. What I need help with is some code...
    5. multiple grids on one page - use single Update/Edit/Cancel commands
      Hi - can you access the grid id from DataGridCommandEventArgs ? I have multiple similar grids on the one page, and want to use the same events to...
  3. #2

    Default Re: Update database without submit button (single page code) ASP

    On 23 Jun 2004 08:58:43 -0700, [email]matt@lazertype.co.uk[/email] (Madge) wrote:
    >Please help.
    >
    >Trying to update a record using ASP but within a single page i.e. no
    >submit button. Code below.
    Gotta submit it somehow. The page as rendered resides on the client.
    ASP on a server has no way of knowing the client has done anything
    unless some client-side code is activated that posts to the server,
    either clicking a Submit button on a form with an action, or through a
    client side script.

    Jeff

    >Thanks in advance - ASP Novice!
    >
    ><%
    >Dim objRS__MMColParam
    >objRS__MMColParam = "1"
    >If (Request.Form("cartId") <> "") Then
    > objRS__MMColParam = Request.Form("cartId")
    >End If
    >%>
    >
    ><%
    >Dim whichOne
    >'here we are getting the number from the URL
    >whichOne = Request.QueryString("Country")
    >If whichOne = "GB" Then
    >'if whichOne is one we do this
    >
    >Set objRS = Server.CreateObject("ADODB.Recordset")
    >objRS.ActiveConnection = MM_INVITE_CON1_STRING
    >objRS.Source = "SELECT * FROM tblSessions WHERE OrderRef = '" +
    >Replace(objRS__MMColParam, "'", "''") + "'"
    >objRS.CursorType = 0
    >objRS.CursorLocation = 2
    >objRS.LockType = 1
    >objRS.Open()
    >
    >objRS_numRows = 0
    >
    > ' Now updating records
    > objRS("PayName") = Request.QueryString("name")
    > objRS.Update
    >
    >ElseIf whichOne = "US" Then
    >'if whichOne is two we do this
    >
    >Set objRS = Server.CreateObject("ADODB.Recordset")
    >objRS.ActiveConnection = MM_INVITE_CON1_STRING
    >objRS.Source = "SELECT * FROM tblSessionsUS WHERE OrderRef = '" +
    >Replace(objRS__MMColParam, "'", "''") + "'"
    >objRS.CursorType = 0
    >objRS.CursorLocation = 2
    >objRS.LockType = 1
    >objRS.Open()
    >
    >objRS_numRows = 0
    >ElseIf whichOne = "CA" Then
    >'if whichOne is three we do this
    >
    >Set objRS = Server.CreateObject("ADODB.Recordset")
    >objRS.ActiveConnection = MM_INVITE_CON1_STRING
    >objRS.Source = "SELECT * FROM tblSessionsCA WHERE OrderRef = '" +
    >Replace(objRS__MMColParam, "'", "''") + "'"
    >objRS.CursorType = 0
    >objRS.CursorLocation = 2
    >objRS.LockType = 1
    >objRS.Open()
    >
    >objRS_numRows = 0
    >Else
    >'otherwise we tell them they did not make a choice
    >Response.Write "You did not make a choice, go back and do so now."
    >End If
    >%>
    >
    ><%
    >objRS.Close()
    >Set objRS = Nothing
    >%>
    Jeff Cochran Guest

  4. #3

    Default Re: Update database without submit button (single page code) ASP

    <<
    Trying to update a record using ASP but within a single page...
    >>
    Don't know if this might hopefully give you any ideas:

    ASP Design Tips - Post Back Page
    [url]http://www.bullschmidt.com/devtip-postbackpage.asp[/url]

    Or this piece of JavaScript that can used client-side and put on an
    onclick or onchange or whatever:

    document.myform.submit();

    Best regards,
    J. Paul Schmidt, Freelance ASP Web Designer
    [url]http://www.Bullschmidt.com[/url]
    ASP Designer Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...


    *** Sent via Devdex [url]http://www.devdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Bullschmidt Guest

  5. #4

    Default Re: Update database without submit button (single page code) ASP

    Possible, as you use querystring.

    Check at your objRS.LockType = 1 for update. This is wrong.

    Type 1 is read-only. You need to use other type. I can't recall which, but I
    guess they are 4 types all together. You can try use objRS.LockType = 2 for
    update.
    > Please help.
    >
    > Trying to update a record using ASP but within a single page i.e. no
    > submit button. Code below.
    >
    > Thanks in advance - ASP Novice!

    IPT Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139