Set rs = Conn.execute("select brugernavn from brugere where brugernavn = '" & newbruger & "'") If rs.eof Then 'Brugernavnet er ledigt Else 'Brugernavnet er optaget End if Set rs = nothing
Set aa = Conn.execute("select username from users where username = '" & newbruger & "'") If aa.eof Then Set rs = Server.CreateObject("ADODB.RecordSet") strSQL = "Select * From users" rs.Open strSQL, Conn, adOpenKeyset, adLockOptimistic
reponse.write "The player, " & rs("Username") & " is created!<br><br><a href='login.asp'>Login here</a>" Else Response.write "<b> [ The Username: " & Request.form("username") & " <br>... is already taken ]</b><br><br><a href='create.asp?s=2'>Back</a>" End if Set aa = nothing
Du skal flytte Set "rs = nothing" inden for if-sætningen således at den kun bliver udført hvis "rs" åbnes.
Set aa = Conn.execute("select username from users where username = '" & newbruger & "'") If aa.eof Then Set rs = Server.CreateObject("ADODB.RecordSet") strSQL = "Select * From users" rs.Open strSQL, Conn, adOpenKeyset, adLockOptimistic
reponse.write "The player, " & rs("Username") & " is created!<br><br><a href='login.asp'>Login here</a>" rs.Close ' Må kun lukkes når den er åben Set rs = Nothing Else Response.write "<b> [ The Username: " & Request.form("username") & " <br>... is already taken ]</b><br><br><a href='create.asp?s=2'>Back</a>" End if Set aa = nothing
Set aa = Conn.execute("select username from users where username = '" & newbruger & "'") If aa.eof Then Set rs = Server.CreateObject("ADODB.RecordSet") strSQL = "Select * From users" rs.Open strSQL, Conn, adOpenKeyset, adLockOptimistic
reponse.write "The player, " & strUsername & " is created!<br><br><a href=""login.asp"">Login here</a>" Else Response.write "<b> [ The Username: " & Request.form("username") & " <br>... is already taken ]</b><br><br><a href='create.asp?s=2'>Back</a>" End if Set aa = nothing
%>
-------------------------------- Kode slut ------------------------
reponse.write "The player, " & strUsername & " is created!<br><br><a href=""login.asp"">Login here</a>"
Det hedder ikke reponse.write - men response.write:
response.write "The player, " & strUsername & " is created!<br><br><a href=""login.asp"">Login here</a>"
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.