All ASP Code is in RED
'This page doesn't use a session variable so for performance reasons I set the two directives.
'By Setting the EnableSessionState you save the asp.dll from making a call to the MTS to check
'for Session variables used by this page
<%@ Language = "VBScript" @ ENABLESESSIONSTATE=False %>
<%
'Declare all local variables
dim conn
dim rs
dim strsql
dim strconn
'Set local variable to the connection string and open the connection
strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("adoandsqladd.mdb")
set conn = server.createobject("adodb.connection")
conn.open strconn
'Set local recordset variable equal to rs
set rs = server.createobject("adodb.recordset")
'Sets the sql query that determine what records get brought back to the asp page.
'This could easily be change to a very specific set of fields or instead of using a ORDER BY statement
'Using a WHERE statement to determine what records get selected IE(WHERE tblUPDATEADO.id=1)
strsql = "SELECT * FROM tblUpdateADO ORDER BY id"
rs.open strsql, conn
%>
<html>
<head>
<title>signon</title>
</head>
<body>
<h3 align="center">Update w/ADO example</h3>
<td width="10%"><form method="post" name="form1" action="updateado2.asp">
<table>
<%
'Writes out the records, again this could just writing out one record just take away the DO While LOOP
x = 1
rs.movefirst
Do While NOT rs.EOF
%>
<tr><td><strong>First Name</strong></td><td>
<input type="text" size="10" name="FirstName<%= x %>" value="<% = rs("FirstName")%>"></td>
<td><strong>Last Name</strong></td><td>
<input type="text" size="10" name="LastName<%= x %>" value="<% = rs("LastName")%>"></td>
</tr>
<%
x = x + 1
'Don't forget to move the recordset to the next record or your going to have an infinate loop
'Trust me this statement I always forget!
rs.movenext
Loop
%>
<td><input type="Submit" value="Submit Update Example" name"b1"> </font>
</form>
</td></tr>
</table>
</center></div>
</body></html>
Page 2 the page actually re-submits the information back to the database Here is the code that is used to update the information on the demo.
'This page doesn't use a session variable so for performance reasons I set the two directives.
'By Setting the EnableSessionState you save the asp.dll from making a call to the MTS to check
'for Session variables used by this page
<%@ Language = "VBScript" @ ENABLESESSIONSTATE=False %>
<%
'Declare all local variables
dim conn
dim rs
dim strID
'Set local variable to the connection string and open the connection
strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("adoandsqladd.mdb")
set conn = server.createobject("adodb.connection")
conn.open strconn
'Set record set object and opens the table that will update the records
set rs = server.createobject("adodb.recordset")
rs.open "tblUpdateADO", conn, 2, 2
rs.movefirst
for x = 1 to 5
rs("FirstName") = request("FirstName" & x)
rs("LastName") = request("LastName" & x)
rs.update
rs.movenext
Next
rs.movefirst
%>
<html>
<head>
<title>Results of the Update ADO Demo</title>
</head><body>
<table BORDER="0">
<% x = 1
rs.movefirst
Do While NOT Rs.EOF
%>
<tr><td><strong>First Name</strong></td><td><% = rs("FirstName")%></td><td>
<strong>Last Name</strong></td><td><% = rs("LastName")%></td></tr>
<%
x = x + 1
rs.movenext
Loop
%>
</table>
<p><a href="updateado.asp">Click here to go back to the start page</a></p>
</body>
</html>
<%
set rs= nothing
set conn = nothing
%>
Good Luck!!