I have been struggling with this code now for 2 days.
Our client requires that we have 2 screens.
The first screen allows them to enter an id to be updated.
Once they click the submit button, they are taken to the second screen where records associated with the id are displayed.
One of those records includes a dropdown menu; in this case, they are allowed to select a different record from the dropdown to be updated.
Once all records to be modified have been modified, the user then clicks save to save new modified records to the database.
No matter what I did, I keep getting this error message:
Error Type:
ADODB.Field (0x80020009)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
I know this means that no records are found but there are records on the database.
Below is my entire code.
Any help is greatly appreciated.
<%
Dim mode
mode=request.form("search")
set my_conn= Server.CreateObject("ADODB.Connection")
my_Conn.Open "DSN=guestbook"
sql="select * from guestbook"
set crs = my_Conn.execute(sql)
'Exeute this query and collect records in recordset crs
if mode<>"" then
code=request.form("code")
sql="select * from guestbook where ID=" & code
set crs = my_Conn.execute(sql)
'response.write sql
'response.end
'Execute this query and collect records in recordset rs
end if
if request.form("update")<>"" then
'collect the values from the form and update the database
end if
%>
<html>
<body>
<form name="f1" action="editJob.asp" method="post">
Enter Class Code:
<%if mode="" then%>
<input type=text name="code">
<input type=submit name="search" value="submit">
<%else%>
Class Code
<select name="code">
<%
while not crs.eof
if code=crs("id") then%>
<option selected value="<%=crs("id")%>"><%=crs("id")%></opt ion>
<%else%>
<option value="<%=crs("id")%>"><%=crs("id")%></opt ion>
<%end if
crs.movenext
wend%></select><br>
Title
<input type=text name="city" value="<%=crs("name")%>"><br>
Date
<input type=text name="state" value="<%=crs("city")%>"><br>
Name
<input type=text name="dob" value="<%=crs("dte")%>"><br>
<input type=submit name="update" value="save">
<%end if%>
</form>
</body>
</html>