Hi, i've got a asp page to register a user and check that the username has
not been previously registered, heres the code i have ... that doesnt work
<SCRIPT LANGUAGE=vbscri pt RUNAT=server>
'Adds a record to the table
Dim SQL 'A variable for the SQL statement
Dim ObjConn 'A connection varaible
Dim ObjRS
Set ObjConn = Server.CreateOb ject("ADODB.Con nection")
Set ObjRS = Server.CreateOb ject("ADODB.Rec ordset")
rsSQL = "SELECT * FROM tblUsers WHERE strUser='" & Request.Form("s trUser") &
"' "
SQL = "INSERT INTO tblUsers "
SQL = SQL & "(strUser, strPwd, strEmail) "
SQL = SQL & "VALUES ('"& Request.Form("s trUser") & "', '" &
Request.Form("s trPwd") & "','" & Request.Form("s trEmail") & "')"
ObjRS.Open rsSQL, "DSN=Projec t"
If ObjRS.RecordCou nt > 1 Then
Response.Redire ct ("retry.html ")
Else
ObjConn.Open "DSN=projec t"
ObjConn.Execute SQL
End If
ObjConn.Close
Set ObjConn = nothing
Response.Redire ct("ok.html")
</script>
i am going the right way about it?
if so where have i gone wrong?
if not could someone please point me in the right direction
any help is appeciated
Regards
not been previously registered, heres the code i have ... that doesnt work
<SCRIPT LANGUAGE=vbscri pt RUNAT=server>
'Adds a record to the table
Dim SQL 'A variable for the SQL statement
Dim ObjConn 'A connection varaible
Dim ObjRS
Set ObjConn = Server.CreateOb ject("ADODB.Con nection")
Set ObjRS = Server.CreateOb ject("ADODB.Rec ordset")
rsSQL = "SELECT * FROM tblUsers WHERE strUser='" & Request.Form("s trUser") &
"' "
SQL = "INSERT INTO tblUsers "
SQL = SQL & "(strUser, strPwd, strEmail) "
SQL = SQL & "VALUES ('"& Request.Form("s trUser") & "', '" &
Request.Form("s trPwd") & "','" & Request.Form("s trEmail") & "')"
ObjRS.Open rsSQL, "DSN=Projec t"
If ObjRS.RecordCou nt > 1 Then
Response.Redire ct ("retry.html ")
Else
ObjConn.Open "DSN=projec t"
ObjConn.Execute SQL
End If
ObjConn.Close
Set ObjConn = nothing
Response.Redire ct("ok.html")
</script>
i am going the right way about it?
if so where have i gone wrong?
if not could someone please point me in the right direction
any help is appeciated
Regards
Comment