Registration Form - Error ?


W

Wayne Smith

I've taken the following code from a developers web site which should allow
a user to register and receive an email message with a link to activate
their account, but when I click the link on my home page to take me to the
'registration.aspx' page, it throws up the following error message and I
can't figure out why.

------------------------------------------------------------------------------
Server Error in '/' Application.

--------------------------------------------------------------------------------

Compilation Error
Description: An error occurred during the compilation of a resource required
to service this request. Please review the following specific error details
and modify your source code appropriately.

Compiler Error Message: BC30002: Type 'OleDbConnection' is not defined.

Source Error:



Line 9: Dim MySQL as string = "Insert into Members (uid, pwd, fullname,
email) " & _
Line 10: "Values (@uid, @pwd, @fullname, @email)"
Line 11: Dim MyConn as New OleDbConnection(strConn)
Line 12: Dim Cmd as New OleDbCommand(MySQL, MyConn)
Line 13: With Cmd.Parameters


Source File: d:\websites\swin644498\www\members\Registration.aspx Line:
11

------------------------------------------------------------------------------

The code is in two pages, the first page I called registration.aspx and the
second is called Activation.aspx

registration.aspx

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script language="VB" runat="server">

Sub doInsert(Source as Object, E as EventArgs)
Dim strConn as String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
"Data Source=d:\websites\swin644498\databases\userAccounts.mdb" & ";"
Dim MySQL as string = "Insert into Members (uid, pwd, fullname, email) " &
_
"Values (@uid, @pwd, @fullname, @email)"
Dim MyConn as New OleDbConnection(strConn)
Dim Cmd as New OleDbCommand(MySQL, MyConn)
With Cmd.Parameters
.Add(New OleDbParameter("@uid", frmuid.text))
.Add(New OleDbParameter("@pwd", frmpwd.text))

.Add(New OleDbParameter("@fullname", frmfullname.text))
.Add(New OleDbParameter("@email", frmemail.text))
End With
MyConn.Open()
cmd.ExecuteNonQuery()
MyConn.Close
'Put a label on your page to contain the 'success' response:
label1.text="Thank you for signing up. An email will be sent to you
shortly." & _
"Your response will be needed from that email to activate your account"
doEmail
End Sub



Sub doEmail(Source as Object, E as EventArgs)
Dim objMail as New MailMessage
objMail.To=txtEmail.text
objMail.FROM="(e-mail address removed)"
objMail.SUBJECT="Congratulations, only one more step to go"
objMail.BODY="To complete the registration on our site, " & _
"please click on the link below" & vbcrlf & vbcrlf & _
"http://Activation.aspx?uid=" & txtUID.text
objMail.BodyFormat = MailFormat.Text
SmtpMail.SmtpServer="email.server.com"
SmtpMail.Send(objMail)
End Sub

</script>


<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Registration</title>
</head>

<body>

<form Name="form1" runat="server">
<table>
<tr>
<td align="right">uid</td>
<td> <asp:textbox id="frmuid" runat="server" /></td>
</tr>
<tr>
<td align="right">pwd</td>
<td> <asp:textbox id="frmpwd" runat="server" /></td>
</tr>
<tr>
<td align="right">fullname</td>
<td> <asp:textbox id="frmfullname" runat="server" /></td>
</tr>
<tr>
<td align="right">email</td>
<td> <asp:textbox id="frmemail" runat="server" /></td>
</tr>

<td align="right">
<asp:button
id="button1"
onclick="doInsert"
Text="Submit" runat="server" />
</td>
</tr>
</table>
</form>



</body>

</html>


----------------------------------------------------------------------------------------------------------

Activation.aspx

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<script language="VB" runat="server">
Dim sUID as String
Sub Page_Load(Source as Object, E as EventArgs)
sUID=request.QueryString ("uid")
Dim strConn as String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
"Data Source=d:\websites\swin644498\databases\userAccounts.mdb" & ";"
Dim MySQL as string = "Update Members Set verify='YES' where UID='" & sUID
& "'"
Dim MyConn as New OleDbConnection(strConn)
Dim Cmd as New OleDbCommand(MySQL, MyConn)
MyConn.Open()
cmd.ExecuteNonQuery()
Label1.text="Thank you. Your email address has been verified." & _
"You may now use your User ID and PWD to login to the site"
MyConn.Close
End Sub
</script>

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Activation</title>
</head>

<body>

</body>

</html>
--------------------------------------------------------------------------------

Can anyone see anything really obvious with the above code that I may be
overlooking, I followed the instructions to the letter on the developers web
site where I found the example but I just can't seem to get it to work.

The only change I made was to the following line:

Dim strConn as String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
server.mappath("\userAccounts.mdb") & ";"And I changed this to read:

Dim strConn as String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
"Data Source=d:\websites\swin644498\databases\userAccounts.mdb" & ";"

Any help or pointers would be grately appreciated.

Many thanks
Wayne
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top