Greetings!
I am building an application where users can log in to view a directory and manage their own user information. The user's information is added to the database via a web form which is not password protected (client request). They can select their own username and password in this form. However, there can be no duplicate usernames in order to guard against more than one user having the same username and password.
When the form is submitted, a query is kicked off that checks to see if the username has already been chosen by another user. If not EOF, then the username is in use by someone else. If EOF, then the username is available. The problem exists when the user wants to update or change their username.
The problem is that, for some reason, if the user wants to update or change their username, nothing happens. Even worse, it's not even throwing any error messages. When the submit button is clicked, it just returns to the main page with no update message and, when I pull up the users information, it did not update. If I update any field EXCEPT the username...it works. I will list my code...because I have been staring too long at it and can't figure out why it isn't working OR throwing any error messages. Any help would certainly be appreciated!
I am building an application where users can log in to view a directory and manage their own user information. The user's information is added to the database via a web form which is not password protected (client request). They can select their own username and password in this form. However, there can be no duplicate usernames in order to guard against more than one user having the same username and password.
When the form is submitted, a query is kicked off that checks to see if the username has already been chosen by another user. If not EOF, then the username is in use by someone else. If EOF, then the username is available. The problem exists when the user wants to update or change their username.
The problem is that, for some reason, if the user wants to update or change their username, nothing happens. Even worse, it's not even throwing any error messages. When the submit button is clicked, it just returns to the main page with no update message and, when I pull up the users information, it did not update. If I update any field EXCEPT the username...it works. I will list my code...because I have been staring too long at it and can't figure out why it isn't working OR throwing any error messages. Any help would certainly be appreciated!
Code:
If Request.Form("editSurveyBtn") <> "" Then
'get the search criterion from the form
surveySrchTerm = Request.Form("ID_member")
surveySrchTerm = CLng(surveySrchTerm)
'Dim verifyUserName
verifyUserName = Request.Form("username")
verifyUserName = cStr(verifyUserName)
'verify that username has not been chosen by another user
Dim sqlUserName
Dim objRSUserName
Set objRSUserName = Server.CreateObject("ADODB.Recordset")
sqlUserName = "SELECT member_survey.ID_member, member_survey.username FROM member_survey WHERE member_survey.username='" & verifyUserName & "';"
'open a recordset containing the one record we want to edit
objRSUserName.Open sqlUserName, objConn, 2, 3
If Not objRSUserName.EOF Then
If Not objRSUserName("memberID") = surveySrchTerm Then
'if we are not EOF, then the username exists and cannot be used again. Refresh form with error message
Response.Redirect "[URL unfurl="true"]http://www.cbstest.com/admin/surveys.asp?display=survey&choice=edit&error=error&id="[/URL] & surveySrchTerm
Else
(run update query)
End If
End If