Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating multiple records

Status
Not open for further replies.

Kevin123456

Technical User
Jan 14, 2002
35
0
0
GB
Hi,

Can anyone suggest how to update the records that have been returned from a form. There could be upwards of 1000 records in the form containing username, location information and the only details that are changing would be a couple of checkboxes which may or may not be checked by the user. I can understand using while loops or for ... next loops but is there any way of identifying just the records that have changed and updating them?

Thanks

 
What about have a set of hidden inputs that store the original values of the check boxes? Then a comparison could be made between the checkboxes that can be seen and there hidden partners.

Simon
 
If all the information is being submitted in a form then I dont think you can just pick out the changed info without checking it all first (may be wrong tho)

You could display all the info and then only let the user change one bit at a time - commonly changing info could be left in the form fields whereas the remaining contents could each be displayed as a separate link that would allow the user to edit it if they clicked on it. I hope that is clear - if not I'll explain in more detail.

Tony
 
Both ideas sound like they may be feasible thanks.
 
Kevin-
You could set a javascript function that would change a hidden input for each row. then just use the rows that have that value changed.
Code:
<%
sql=&quot;Select * from myTable&quot;
rs.open sql,conn,2,3

if NOT rs.EOF then
    i=0%>
  <form name=&quot;Edit_Job&quot; action=&quot;makechange.asp&quot; method=&quot;POST&quot;>
  <Table name=&quot;changeme&quot;>
    <%While Not RS.EOF %>
      <input type=&quot;hidden&quot; name=&quot;ChangedRecord_<%=i%>&quot;>
       <input type=&quot;text&quot; name=&quot;init<%=i%>&quot; value=&quot;<%=RS.Fields(&quot;init&quot;)%>&quot; OnChange=&quot;document.window.changeme.ChangedRecord_<%=i%>.value=&quot;Changed&quot;&quot;>
    <%RS.MoveNext
     i=i+1
     Wend
Else
    Response.Write(&quot;No Records found&quot;)
End If
rs.close%>

Hope this helps!
 
Edcrosbys,

Thanks for the reply, just a couple of daft queries about the code. What does the RS.Field(&quot;init&quot;) do? Is this the same as Results(&quot;Fieldname&quot;). What does the init part do and how would you process the fields in the makechange.asp?

Apologies for the questions.

Kevin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top