I have a simple form that collects names in time slots. The form lists all the time slots with the names and blank spots available.
The problem I'm running into is people are overwriting other names so they can get a time slot they want. I've done some research and think concurrency checks are the way to go, but am lost as how to impliment these.
The code I have is:
<%
Set rs = Server.CreateObject("ADODB.RecordSet")
SQL = "SELECT * FROM OpenEnrollment2 WHERE ID = '1'"
rs.Open SQL, conn, AdOpenStatic, AdLockOptimistic
If request("Submit") <> "" then
SQL = "UPDATE OpenEnrollment2 SET "
SQL = SQL & "C1 = '" & replace(request("C1"), "'", "`") & "', "
SQL = SQL & "C2 = '" & replace(request("C2"), "'", "`") & "', "
SQL = SQL & "C3 = '" & replace(request("C3"), "'", "`") & "', "
SQL = SQL & "C4 = '" & replace(request("C4"), "'", "`") & "', "
SQL = SQL & "C5 = '" & replace(request("C5"), "'", "`") & "', "
SQL = SQL & "C6 = '" & replace(request("C6"), "'", "`") & "', "
SQL = SQL & "C7 = '" & replace(request("C7"), "'", "`") & "', "
SQL = SQL & "C8 = '" & replace(request("C8"), "'", "`") & "', "
SQL = SQL & "C9 = '" & replace(request("C9"), "'", "`") & "', "
SQL = SQL & "C10 = '" & replace(request("C10"), "'" "`") & "', "
SQL = SQL & "WHERE ID = '" & rs("ID") & "'"
conn.Execute SQL
response.redirect("confirm.asp")
End If
%>
And the listing code is:
<input type="text" name="C1" size="20" value="<% = rs("C1") %>">
I'm new at this, so this may not be the way to do this type of form, but it is what I came up with. I have an established record in the database (ID = '1') and just have the form update that dataset.
I want to make it so Person2 cannot overwrite Person1's name when Person2 goes to sign up for a time slot.
Can someone help me in this direction without slamming a newbie?
Thanks in advance.