Jump to content

nanquan

Members
  • Posts

    3
  • Joined

  • Last visited

nanquan's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. This is so embarrassing! I'm posting the solution in the unlikely event that someone else ever encounters this sort of a problem...The reason I experienced this strange behavior is that In my original code, I forgot to add quotes to the name inside my SQL string: sql = "Select * From user_database Where username=" & LCase(Request.Form("Username"))Should have been:sql = "Select * From user_database Where username='" & LCase(Request.Form("Username")) & "'" I can't believe I missed that... I guess I was just really tired when I was writing that code.. hehe!
  2. 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, connIf 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!
×
×
  • Create New...