<% dim conn 'database connection object dim rs 'recordset dim strSQL 'sql query dim endline 'set endline endline = chr(10) 'create the connection object set conn = Server.CreateObject("ADODB.Connection") 'open the connection conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\home\hnt7c211\legacy\f7e8af3jk23sd3.mdb;" 'create a recordset set rs = Server.CreateObject("ADODB.Recordset") if Request.ServerVariables("REQUEST_METHOD") = "POST" then 'save this site to the database strSQL = "SELECT * FROM Sites" 'set rs properties rs.CursorType = adOpenDynamic 'to move dynamically through rs rs.LockType = adLockOptimistic 'to lock the recordset while updating 'run the query rs.Open strSQL, conn dim match match = false do while not rs.EOF if rs.Fields("Website") = Request.Form("Website") then match = true exit do end if rs.MoveNext loop if match then Session("responseString") = "We're sorry, but that website is already on the list!" else 'add a new record rs.AddNew 'now add the fields rs.Fields("FirstName") = Request.Form("FirstName") rs.Fields("LastName") = Request.Form("LastName") rs.Fields("Website") = Request.Form("Website") 'write to the database rs.Update Session("responseString") = "Your website has been added to the list of Links.

" end if 'close the database connection rs.Close 'redirect to form_submit Response.Redirect "form_submit.asp" end if %> Legacy Cruise II
<%=welcomeString%>

Legacy Cruise II departs in
Links to family members' web pages

<% 'set the sql statement strSQL = "SELECT * FROM Sites ORDER BY LastName,FirstName" 'run the query and save to rs rs.Open strSQL, conn if rs.EOF then response.write( "No one has added a website to the database yet" ) else 'write results do while not rs.EOF response.write( "" &_ rs.Fields("LastName") & ", " & rs.Fields("FirstName") & "
" ) rs.MoveNext loop end if 'now close connection rs.Close set rs = Nothing set conn = Nothing %>

 

Submit a site to be added to this list:

First Name:
Last Name:
URL: