<% '******************************************************* '* ASP 101 Sample Code - http://www.asp101.com/ * '* * '* This code is made available as a service to our * '* visitors and is provided strictly for the * '* purpose of illustration. * '* * '* http://www.asp101.com/samples/license.asp * '* * '* Please direct all inquiries to webmaster@asp101.com * '******************************************************* %> <% Const adVarChar = 200 Const adBoolean = 11 Dim rstUserData ' Normally this would be the result of a query something like this: ' SELECT * FROM TableName WHERE id=123; ' or: ' SELECT * FROM TableName WHERE email LIKE 'EmailAddressGoesHere'; ' ' For simplicity, my recordset isn't actually connected to anything. ' Create the stand alone recordset Set rstUserData = Server.CreateObject("ADODB.Recordset") rstUserData.Fields.Append "Name", adVarChar, 50 rstUserData.Fields.Append "Email", adVarChar, 100 rstUserData.Fields.Append "Updates", adBoolean rstUserData.Open ' Add the sample data to our recordset. Again, this data would ' normally be a result of a query against your database. rstUserData.AddNew rstUserData.Fields("Name").Value = "John" rstUserData.Fields("Email").Value = "JohnsEmailWouldGoHere" rstUserData.Fields("Updates").Value = True rstUserData.Update If Request.Form("save") = "Save" Then ' Save data from the form back to the recordset. rstUserData.MoveFirst rstUserData.Fields("Name").Value = Request.Form("name") rstUserData.Fields("Email").Value = Request.Form("email") rstUserData.Fields("Updates").Value = (Request.Form("updates") = "on") rstUserData.Update %>

Data updated. You can continue making chages via the form below or ">start over.

<% End If ' Else ' Display the form with the data from the recordset. ' If the user just saved the data, you might not want to show the ' form again. In that case change the "End If" above to an "Else" ' and uncomment the last "End If" on the page. If Not rstUserData.EOF Then %>
" method="post">
Name: " />
Email: " />
Send Me Updates: />
 
<% End If ' End If %>