How does one update all records displayed in a asp page



I got a test asp page which connects to Northwind.mdb database. This page
pulls all the rows from the Customers table. One column i.e. GoodStatus has
been added to the customers table. The following is the code to display all
records of the customers table with some customization.
<%@ Language=VBScript %>
<!-- #include file="" -->

<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<title>Testing Multiple Records Save</title>


sub btn_LogOut_OnClick()
dim asnwer
answer=msgbox("Are you sure you want to exit?.",vbYesNo,"Warning")
if answer=vbyes then
window.location.href = "http://localhost/beginaspdatabase1/"
end if
end sub

sub btn_Save_OnClick()
dim asnwer
answer=msgbox("Are you sure you want to save your
if answer=vbyes then
window.location.href =
end if
end sub


myDSN="Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Northwind97\Northwind.mdb"

set CN=server.createobject("ADODB.Connection")
CN.Open myDSN

set sRS=server.createobject("ADODB.Recordset")

sRS.ActiveConnection = CN

SQL = "SELECT EmployeeID, LastName, FirstName, Title, GoodStatus from
'Response.Write SQL & "<br>"
sRS.Open SQL


<big><big><font COLOR="navy">Test Database Northwind</font></big></big>

<font COLOR="red">Saving changes of all records at one time</font>

Response.Write "<table border='1' width='50%' height='1' cellspacing='1' >"
Response.Write "<th>ID</th><th>Last Name</th><th>First
Name</th><th>Title</th><th>Good Status</th>"
do until sRS.eof
ID = sRS("EmployeeID")
LastName = sRS("LastName")
FirstName = sRS("FirstName")
Title = sRS("Title")
l_GoodStatus = sRS("GoodStatus")

<td align='center' width = '5%'>
<font color="#000000">
<%Response.Write ID%></font>

<td align='center' width = '12%'>
<font color="#000000">
<%Response.Write LastName%>

<td align='center' width = '12%' >
<font color="#000000">
<%Response.Write FirstName%>

<td align='center' width = '10%'>
<font color="#000000">
<input type="text" name="txt_Title" size="33" value ="<%Response.Write
(Title)%>" style="font-family: Times New Roman; font-size: 10pt"></font>

<%'Response.Write Title%>

<td align='center' width = '8%'>
<font color="#000000">
<input type="checkbox" name="chk_GoodStatus" value="ON" <%Response.write
l_GoodStatus%><%if cbool(l_GoodStatus) then response.write " checked" else
Response.write " unchecked"%>>

Set sRS = Nothing


<input type="button" value="Log Out" name="btn_LogOut" >
<input type="submit" value="Save" name="btn_Save">


Now I need to change some values in the title and goodstatus field and save
all the changes in whatever records made. This update has to be in asp page
update_all_records.asp as pointed in the code above. I have no idea how to
handle all the rows as in the present case. Any help or suggestion is
appreciated. Thanks.




Best bet is...
1. Pass all the values in a form to SqlParameters (one value to one
2. Then Create a stored procedure that uses these parameters.
then you can update, insert, whatever it is you want to do.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question