baxtalo
asked on
How to avoid BOF EOF error when there is no record in the database
With the following line I retrieve the checkmark as a letter (ü) from my column named EIT:
<%If rs3.BOF and rs3.EOF then Response.Write " " Else response.write rs3.fields("EIT") End If%>
I would like to do the same when I use a checkbox, but it gives me the BOF EOF error. Could you please help me modify the code below so that the checkbox shows even when there is no record.
Thank you
<%If rs3.BOF and rs3.EOF then Response.Write " " Else response.write rs3.fields("EIT") End If%>
I would like to do the same when I use a checkbox, but it gives me the BOF EOF error. Could you please help me modify the code below so that the checkbox shows even when there is no record.
Thank you
<%
If Not rs3.EOF Then
If rs3("EIT") = "ü" Then %>
<input name="EIT" value="ü" checked type="checkbox">
<% Else %>
<input name="EIT" value="ü" type="checkbox">
<% End IF
End IF
%>
ASKER
It gives me this error message:
ADODB.Field error '80020009'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/EIT/00.asp, line 0
It would be nice if the error would be replaced by like in the case of my first line when there is no record.
ADODB.Field error '80020009'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/EIT/00.asp, line 0
It would be nice if the error would be replaced by like in the case of my first line when there is no record.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
That error is not related to the BOF/EOF directly. You have no current record.
Can you post the entire piece of code?
Can you post the entire piece of code?
ASKER
I was absolutely sure that the problem was caused by this peace of code. It was right at the end of the page, just before the submit button. Angellll, when you asked if I was sure, I just cut it out to see what happens. The error was still there, so I knew you were right. What else was on the page? A hidden field before the submit button:
<input type="hidden" name="ID" value="<%=rs3("ID")%>">
I replaced with the code below, and now the problem is fixed.
<input type="hidden" name="ID" value="<%If rs3.BOF and rs3.EOF then Response.Write " " Else response.write rs3.fields("ID") End If%>">
I'm sorry for the confusion. Angellll, I did this to you for the second time. Thanks for your patience with me and I hope you won't ignore my questions in the future.
<input type="hidden" name="ID" value="<%=rs3("ID")%>">
I replaced with the code below, and now the problem is fixed.
<input type="hidden" name="ID" value="<%If rs3.BOF and rs3.EOF then Response.Write " " Else response.write rs3.fields("ID") End If%>">
I'm sorry for the confusion. Angellll, I did this to you for the second time. Thanks for your patience with me and I hope you won't ignore my questions in the future.
ASKER
Thank you very much
Open in new window