Recordset Mishaps!!!

Results 1 to 2 of 2

Thread: Recordset Mishaps!!!

  1. #1
    Join Date
    Dec 1969

    Default Recordset Mishaps!!!

    Hi all,<BR>I have a form on a page that the user supplies information for and the last 2 fields are username and password. Upon submission, the data is sent to an ASP where an intial query is fired (have a connection called myCon and a recordset called RS):<BR> mySQL1 = "SELECT * FROM table WHERE username = &#039;" & strUsername & "&#039;"<BR> mySQL1, myCon<BR><BR>Simple enough...<BR><BR>Then, to see whether or not to insert the record, I do the following:<BR><BR>If RS.EOF Then<BR> &#039;insert the record and display a success message<BR>Else<BR> &#039;don&#039;t insert and display an error message<BR>End If<BR><BR>This works fine if the username doesn&#039;t already exist. However, when you click the back button to reenter your username, then re-submit the form with a valid username, I get the error message.<BR><BR>This thing is driving me insane! I have tried all of the methods on the ASPFAQ&#039;s page (from Bill Wilkerson and others) to no avail. My *guess* is that I am having a problem with my recordset on the second submission. PLEASE HELP!!!<BR><BR>Many thanks in advance,<BR><BR>JOHN

  2. #2
    Join Date
    Dec 1969

    Default RE: Recordset Mishaps!!!

    Try this<BR><BR>Dim StrCnt<BR><BR>mySQL1 = "SELECT Count(YourRecordID) as CurrentUser FROM table WHERE username = &#039;" & strUsername & "&#039;" <BR> mySQL1, myCon<BR><BR>If RS("CurrentUser") = 0 Then<BR>&#039;insert the record and display a success message<BR>Else<BR>Response.write "&#060;a href=&#039;javascript:history.back(1)&#039;&#062;T ry again&#060;/a&#062;" & vbcrlf<BR>End If<BR><BR>Close your recordset and db connections<BR> <BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts