|
-
Nov 2nd, 2004, 07:15 AM
#1
Thread Starter
New Member
send password - message
I have a forgot password page that successfully sends the password to a user. All I want to do is add a line of text that says "your email has been sent" when the request is valid and "your email address was not found" if the request fails . I want to be able to put that message in a row of the table. I am very new to asp.net and don't know how to do that. Here is the code that I have created ( I have not included the table and form information) that successfully sends the password:
Sub Button1_Click(sender As Object, e As EventArgs)
Dim lostpwd AS string
Dim mailMessage As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage
Dim passwordDS AS System.Data.DataSet = GetEmail(email.Text)
If passwordDS.Tables(0).Rows.Count = 1 Then
lostpwd = passwordDS.Tables(0).Rows(0).Item(“pwd”).ToString
mailMessage.From = "[email protected]"
mailMessage.To = email.Text
mailMessage.Subject = "Lost Password"
mailMessage.BodyFormat = System.Web.Mail.MailFormat.Text
mailMessage.Body = "here is your password: " + lostpwd + chr(13) + "if you have questions, please contact the site administrator"
System.Web.Mail.SmtpMail.SmtpServer = "ciruelo.xxxx.xx"
System.Web.Mail.SmtpMail.Send(mailMessage)
Else
End if
End Sub
Function GetEmail(ByVal email As String) As System.Data.DataSet
Dim connectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\Inetpub\wwwroot\xxxxx\xxxx.mdb"
Dim dbConnection As System.Data.IDbConnection = New System.Data.OleDb.OleDbConnection(connectionString)
Dim queryString As String = "SELECT [authors].[pwd] FROM [authors] WHERE ([authors].[email] = @email)"
Dim dbCommand As System.Data.IDbCommand = New System.Data.OleDb.OleDbCommand
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection
Dim dbParam_email As System.Data.IDataParameter = New System.Data.OleDb.OleDbParameter
dbParam_email.ParameterName = "@email"
dbParam_email.Value = email
dbParam_email.DbType = System.Data.DbType.String
dbCommand.Parameters.Add(dbParam_email)
Dim dataAdapter As System.Data.IDbDataAdapter = New System.Data.OleDb.OleDbDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim dataSet As System.Data.DataSet = New System.Data.DataSet
dataAdapter.Fill(dataSet)
Return dataSet
End Function
Thanks alot
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|