updating multiple records on one page

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

  1. #1

    Default updating multiple records on one page

    I'm a moderate newcomer to ASP... I have a SQL Server database. I am
    displaying multiple records on a page. I have a field in the database called
    LatestUpdate. I read multiple records out of the database and put the
    LatestUpdate data into a text box. I want the user to be able to edit
    multiple text boxes and save them all with one click. At the bottom of the
    page I will put a "Save All" button so I can update all records. How do I
    make the "Save All" button update each record?

    Thanks in advance! Code is always appreciated :-)


    BP Prgm Guest

  2. Similar Questions and Discussions

    1. Updating multiple records in a linked table simultaneously
      I am working on an e-commerce application and I need help with updating the product details for a single product with multiple formats. --DB...
    2. Updating Multiple records fields in a database atonce
      Is it correct that there is no user interaction on these forms? I didn't see a submit button. Or does someone click on a submit button to get to...
    3. How to display multiple records per page?
      How can i build the easiest way an script which enables me to display an x amount of records per page? Friendly greetings, André
    4. updating multiple records via online form
      Hello, I have a database generated form that I would like users to be able to update by selecting a checkbox. Say the page displayed has six...
    5. Updating Multiple Records
      I have a table in a database that contains all my photos. The fields are like Name, SRC, GalleryName, DateAdded, SpecialStyle. The only one you may...
  3. #2

    Default Re: updating multiple records on one page

    One way to do it is name your textboxes in a certain way, like with all the
    same name but with an ID number as a suffix or something along those lines.
    Something like this:


    <form method="post" action="whatever.asp">
    <input name="txtFirstname1" value="Jorg" type="text">
    <input name="txtFirstname32" value="Marissa" type="text">>
    <input name="txtFirstname45" value="Kylie" type="text">>
    <input name="txtFirstname94" value="Yanni" type="text">>

    <input name="cmdSubmit" value="Update All" type="submit">
    </form>

    On the page that processes:

    <%
    '''assuming multiple submit buttons all having the same name
    If Instr(Request.Form("cmdSubmit"), "Update All") > 0 Then
    '''update all
    For Each f in Request.Form
    If Instr(f, "txtFirstname") = 1 Then
    '''this is a firstname textbox
    '''get the record ID
    sRecordID = Right(f, Len(f) - Len("txtFirstname"))
    sFirstname = "'" & Replace(Request.Form(f),"'", "''))
    sSQL = "UPDATE [TheTable] SET [Firstname]=" & sFirstname & "
    WHERE [ID]=" & sRecordID
    oYourADOConnection.Execute sSQL
    End If
    Next
    oYourADOConnection.Close
    Set oYourADOConnection = Nothing
    End If


    Actually, if you're having an option to update just one or update all, your
    submit buttons will probably all have different names. But that won't
    affect the code significantly.

    Ray at home



    "BP Prgm" <nospam@please.com> wrote in message
    news:OeN03oJfDHA.3024@tk2msftngp13.phx.gbl...
    > I'm a moderate newcomer to ASP... I have a SQL Server database. I am
    > displaying multiple records on a page. I have a field in the database
    called
    > LatestUpdate. I read multiple records out of the database and put the
    > LatestUpdate data into a text box. I want the user to be able to edit
    > multiple text boxes and save them all with one click. At the bottom of the
    > page I will put a "Save All" button so I can update all records. How do I
    > make the "Save All" button update each record?
    >
    > Thanks in advance! Code is always appreciated :-)
    >
    >

    Ray at home 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