D
David Shorthouse
I am attempting to create a "new account creation" asp, but would ideally
like the routine to check the Access db for an existing email address and
username (called UID below). The select query called CheckAccount works as
expected within the db as does the append query CreateAccount. However, the
If statement below after DataConnection.CheckAccount obviously doesn't work
because if I attempt to create an account for which either a username or
email address already exists in the db, the DataConnection.CreateAccount
throws up an error, which should even have taken place in the first place.
Any ideas appreciated.
Dave
Here is what I have in the header. The Response.Writes are below.
<%
Dim p1, p2, p3, p4, p5, p6
p1 = Request.Form("GivenName")
p2 = Request.Form("SurName")
p3 = Request.Form("PWD")
p4 = Request.Form("PWD2")
p5 = Request.Form("Email")
p6 = Request.Form("UID")
If LenB(Request.Form("btnAdd")) <> 0 Then
If p3 = p4 Then
Dim DataConnection, RecordSet, strError1, strError2, strError3
Set DataConnection = Server.CreateObject("ADODB.Connection")
DataConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" & DatabasePath & ";"
Set RecordSet = Server.CreateObject("ADODB.Recordset")
DataConnection.CheckAccount p5, p6, RecordSet
If Not RecordSet.EOF Then
If RecordSet.Fields("Email") = p5 Then
strError1 = "<FONT FACE='ARIAL' SIZE='3'><B>Sorry,
this Email address is taken.</B></FONT>"
Else
strError2 = "<FONT FACE='ARIAL' SIZE='3'><B>Sorry,
this Username is taken.</B></FONT>"
End if
RecordSet.Close
Set RecordSet=Nothing
DataConnection.Close
Set DataConnection=Nothing
Else
RecordSet.Close
Set RecordSet = Nothing
DataConnection.CreateAccount p1, p2, p3, p5, p6
Session("ID") = p6
DataConnection.Close
Set DataConnection = Nothing
Response.Redirect "createprofile.asp"
Response.End
End if
Else
strError3 = "<FONT FACE='ARIAL' SIZE='3'><B>Sorry, your passwords
didn't match.</B></FONT>"
End If
End if
%>
<%
Response.Write (strError1)
Response.Write (strError2)
Response.Write (strError3)
%>
With Text form boxes named GivenName, SurName, PWD, PWD2, Email, UID where
PWD2 doesn't have a field in the db and is merely a check for the client.
Thanks,
Dave
like the routine to check the Access db for an existing email address and
username (called UID below). The select query called CheckAccount works as
expected within the db as does the append query CreateAccount. However, the
If statement below after DataConnection.CheckAccount obviously doesn't work
because if I attempt to create an account for which either a username or
email address already exists in the db, the DataConnection.CreateAccount
throws up an error, which should even have taken place in the first place.
Any ideas appreciated.
Dave
Here is what I have in the header. The Response.Writes are below.
<%
Dim p1, p2, p3, p4, p5, p6
p1 = Request.Form("GivenName")
p2 = Request.Form("SurName")
p3 = Request.Form("PWD")
p4 = Request.Form("PWD2")
p5 = Request.Form("Email")
p6 = Request.Form("UID")
If LenB(Request.Form("btnAdd")) <> 0 Then
If p3 = p4 Then
Dim DataConnection, RecordSet, strError1, strError2, strError3
Set DataConnection = Server.CreateObject("ADODB.Connection")
DataConnection.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" & DatabasePath & ";"
Set RecordSet = Server.CreateObject("ADODB.Recordset")
DataConnection.CheckAccount p5, p6, RecordSet
If Not RecordSet.EOF Then
If RecordSet.Fields("Email") = p5 Then
strError1 = "<FONT FACE='ARIAL' SIZE='3'><B>Sorry,
this Email address is taken.</B></FONT>"
Else
strError2 = "<FONT FACE='ARIAL' SIZE='3'><B>Sorry,
this Username is taken.</B></FONT>"
End if
RecordSet.Close
Set RecordSet=Nothing
DataConnection.Close
Set DataConnection=Nothing
Else
RecordSet.Close
Set RecordSet = Nothing
DataConnection.CreateAccount p1, p2, p3, p5, p6
Session("ID") = p6
DataConnection.Close
Set DataConnection = Nothing
Response.Redirect "createprofile.asp"
Response.End
End if
Else
strError3 = "<FONT FACE='ARIAL' SIZE='3'><B>Sorry, your passwords
didn't match.</B></FONT>"
End If
End if
%>
<%
Response.Write (strError1)
Response.Write (strError2)
Response.Write (strError3)
%>
With Text form boxes named GivenName, SurName, PWD, PWD2, Email, UID where
PWD2 doesn't have a field in the db and is merely a check for the client.
Thanks,
Dave