S
sista via DotNetMonster.com
Wonder why I always got tis error?
help....
here's my code in forgot.aspx.vb
------------------------------------------------------------------
Sub lookup_click(ByVal s As Object, ByVal e As EventArgs)
Dim email As String = Request.Form("email")
Dim p As New PartyHouse
Dim ds As DataSet
ds = p.getDetail("*", "member", "memail", email)
If ds Is Nothing Then
msg.Text = "<font color=red>Sorry, there is no user with email
address <b>" & _
email & "</b> found.<br>Click <a href='register2.aspx'>here</a>
to register.</font>"
Else
Dim msgMail As New MailMessage
msgMail.To = email
msgMail.From = "(e-mail address removed)"
msgMail.Subject = "Password look up - PartyHouse.com"
With ds.Tables("member").Rows(0)
msgMail.BodyFormat = MailFormat.Html
msgMail.Body = "<html><body><a
href='https://localhost/partyhouse/'><img src='img/logomask.gif'></a>" & _
"<p>Dear " & .Item("title") & " " & .Item("fname") & "
" & .Item("lname") & ",</p>" & _
"<p>Your password is <b>" & .Item("mpassword") & "</b>.
" & _
"<p>Please keep this information for future use.</p>" &
_
"<p><br><br> Administrator @ <a
href='https://localhost/partyhouse/'>PartyHouse.com</a></p>" & _
"</body></html>"
End With
SmtpMail.Send(msgMail)
Response.Redirect("lookedup.htm")
End If
End Sub
-----------------------------------------------------------------
Here's my code for Partyhouse class:
-----------------------------------------------------------------
Public Function getDetail(ByVal thing As String, ByVal table As String,
ByVal cond1 As String, ByVal val1 As String) As DataSet
oCon = New OleDbConnection( _
"Provider=sqloledb;" & _
"Data Source=ts04.comp.nus.edu.sg,1433;" & _
"Initial Catalog=cs3266_00;" & _
"User Id=lydiasun;" & _
"Password=u0201098")
Dim query As String
query = "select " & thing & " from " & table & " where " & cond1 &
"='" & val1 & "'"
Dim mycommand As New OleDbCommand(query, oCon)
oCon.Open()
Dim dr As OleDbDataReader
dr = mycommand.ExecuteReader(CommandBehavior.CloseConnection)
Dim ds As DataSet
If dr.HasRows = True Then
ds = ConvertDataReaderToDataSet(dr)
'this function is to convert data reader to dataset.
'it's correct i've tried it out.
Else
ds = Nothing
End If
oCon.Close()
Return ds
End Function
help....
here's my code in forgot.aspx.vb
------------------------------------------------------------------
Sub lookup_click(ByVal s As Object, ByVal e As EventArgs)
Dim email As String = Request.Form("email")
Dim p As New PartyHouse
Dim ds As DataSet
ds = p.getDetail("*", "member", "memail", email)
If ds Is Nothing Then
msg.Text = "<font color=red>Sorry, there is no user with email
address <b>" & _
email & "</b> found.<br>Click <a href='register2.aspx'>here</a>
to register.</font>"
Else
Dim msgMail As New MailMessage
msgMail.To = email
msgMail.From = "(e-mail address removed)"
msgMail.Subject = "Password look up - PartyHouse.com"
With ds.Tables("member").Rows(0)
msgMail.BodyFormat = MailFormat.Html
msgMail.Body = "<html><body><a
href='https://localhost/partyhouse/'><img src='img/logomask.gif'></a>" & _
"<p>Dear " & .Item("title") & " " & .Item("fname") & "
" & .Item("lname") & ",</p>" & _
"<p>Your password is <b>" & .Item("mpassword") & "</b>.
" & _
"<p>Please keep this information for future use.</p>" &
_
"<p><br><br> Administrator @ <a
href='https://localhost/partyhouse/'>PartyHouse.com</a></p>" & _
"</body></html>"
End With
SmtpMail.Send(msgMail)
Response.Redirect("lookedup.htm")
End If
End Sub
-----------------------------------------------------------------
Here's my code for Partyhouse class:
-----------------------------------------------------------------
Public Function getDetail(ByVal thing As String, ByVal table As String,
ByVal cond1 As String, ByVal val1 As String) As DataSet
oCon = New OleDbConnection( _
"Provider=sqloledb;" & _
"Data Source=ts04.comp.nus.edu.sg,1433;" & _
"Initial Catalog=cs3266_00;" & _
"User Id=lydiasun;" & _
"Password=u0201098")
Dim query As String
query = "select " & thing & " from " & table & " where " & cond1 &
"='" & val1 & "'"
Dim mycommand As New OleDbCommand(query, oCon)
oCon.Open()
Dim dr As OleDbDataReader
dr = mycommand.ExecuteReader(CommandBehavior.CloseConnection)
Dim ds As DataSet
If dr.HasRows = True Then
ds = ConvertDataReaderToDataSet(dr)
'this function is to convert data reader to dataset.
'it's correct i've tried it out.
Else
ds = Nothing
End If
oCon.Close()
Return ds
End Function