<% 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 Session("ID") then if Request.ServerVariables("REQUEST_METHOD") = "POST" then 'delete the old names strSQL = "SELECT * FROM Party WHERE MasterID=" & Session("ID") & "" rs.LockType = adLockOptimistic 'to lock the recordset while updating rs.Open strSQL, conn do while not rs.EOF rs.Delete rs.MoveNext loop rs.Close 'set the sql statement strSQL = "SELECT * FROM Party" 'set rs properties rs.CursorType = adOpenDynamic 'to move dynamically through rs rs.LockType = adLockOptimistic 'to lock the recordset while updating 'run the query and save to rs rs.Open strSQL, conn 'add a new record for each of the text boxes on the page for i = 1 to Request.Form("PartySize") 'if we have a name to add if not Request.Form("text" & i) = "" then rs.AddNew rs.Fields("MasterID") = Session("ID") rs.Fields("Name") = Request.Form("text" & i) rs.Update end if next rs.Close Session("responseString") = "Your party members' names have been saved to the database." 'redirect to form_submit Response.Redirect "form_submit.asp" end if else Session("responseString") = "You must be signed in to do that! " &_ "Sign in now." 'redirect to form_submit Response.Redirect "form_submit.asp" end if %> Legacy Cruise II
<%=welcomeString%>

Legacy Cruise II departs in
Add the names of your party members:

<% 'get the total number of people in this party dim Party_Size dim Name strSQL = "SELECT Name,Party_Size FROM Users WHERE ID=" & Session("ID") & "" 'set rs properties rs.LockType = adLockReadOnly rs.Open strSQL, conn Name = rs.Fields("Name") Party_Size = rs.Fields("Party_Size") rs.Close 'create a hidden field with the number of textboxes response.write( "" ) 'write the party leader's name response.write( "" ) 'set the sql statement strSQL = "SELECT * FROM Party WHERE MasterID=" & Session("ID") & " ORDER BY Name" 'set rs properties rs.LockType = adLockReadOnly 'run the query and save to rs rs.Open strSQL, conn 'print members already in database and count dim count count = 1 do while not rs.EOF response.write( "" ) count = count + 1 rs.MoveNext loop 'print empty textboxes to add new names for i = count to Party_Size - 1 response.write( "" ) count = count + 1 next 'now close connection rs.Close set rs = Nothing set conn = Nothing %>
" & Name & "