J
John
I can't get my head around this!
I have the following code:
<%
.... Code for connection to the database ...
.... Code for retrieving recordset ...
If Not rs.EOF Then
... Do something...
End If
%>
Very basic. Very simple. Except for the fact the the conditional is
completely ignored when I run the script!! <_<
That's right... I deliberately enter a non existant value in my SQL
query:
<%
sql = "Select * From user_database Where username='non-existant-name'"
rs.Open sql, conn
If Not rs.EOF Then
... Do something...
End If
%>
In this case rs.EOF should be set to true, since the username that I
entered does not exist! Therefor the condition of Not rs.EOF is not
met, and the code inside the conditional should not run, however for
some strange reason it does run... so what's going on here?!
I noticed that if I write it differently it does work like it's
supposed to:
<%
If rs.EOF Then
Response.Write("The record does not exist.<br />")
Else
... Do Something ...
End If
%>
However it should work the other way too, so this is very strange to
say the least! Does anybody have any idea as to what is going on here?
Is there something wrong with my code? Because I noticed that when I
use the 'Else' clause it does work... but since when is it a problem
writing a conditional without an 'Else' clause?
Thanks!
I have the following code:
<%
.... Code for connection to the database ...
.... Code for retrieving recordset ...
If Not rs.EOF Then
... Do something...
End If
%>
Very basic. Very simple. Except for the fact the the conditional is
completely ignored when I run the script!! <_<
That's right... I deliberately enter a non existant value in my SQL
query:
<%
sql = "Select * From user_database Where username='non-existant-name'"
rs.Open sql, conn
If Not rs.EOF Then
... Do something...
End If
%>
In this case rs.EOF should be set to true, since the username that I
entered does not exist! Therefor the condition of Not rs.EOF is not
met, and the code inside the conditional should not run, however for
some strange reason it does run... so what's going on here?!
I noticed that if I write it differently it does work like it's
supposed to:
<%
If rs.EOF Then
Response.Write("The record does not exist.<br />")
Else
... Do Something ...
End If
%>
However it should work the other way too, so this is very strange to
say the least! Does anybody have any idea as to what is going on here?
Is there something wrong with my code? Because I noticed that when I
use the 'Else' clause it does work... but since when is it a problem
writing a conditional without an 'Else' clause?
Thanks!