CODES : Forgot pwd

[A] : Here we can retrieve the loginid,password of any user via its three parameters . if u get doubt put comments in here :
Imports System.Data
Imports System.Data.SqlClient
Partial Class forgot_password
Inherits System.Web.UI.Page

Protected Sub btnpwd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnpwd.Click
Dim rdr As SqlDataReader
Dim param1, param2, param3 As SqlParameter
Dim sb As New StringBuilder
sb = sb.Append("SELECT login_id,password ")
sb = sb.Append("FROM recruitment_db ")
sb = sb.Append("WHERE pwdrq=@pwdrq and pwdra=@pwdra and dob=@dob")
Dim objconn As New SqlConnection
objconn.ConnectionString = ConfigurationManager.ConnectionStrings("hcms").ConnectionString
Try
objconn.Open()
Dim objcmd As New SqlCommand
objcmd.Connection = objconn
objcmd.CommandText = sb.ToString()
param1 = objcmd.Parameters.Add("@pwdrq", SqlDbType.VarChar)
param1.Value = Me.ddnprq.SelectedItem.Text
param2 = objcmd.Parameters.Add("@pwdra", SqlDbType.VarChar)
param2.Value = Me.txtpra.Text.ToString
param3 = objcmd.Parameters.Add("@dob", SqlDbType.DateTime)
param3.Value = Me.txtdob.Text
rdr = objcmd.ExecuteReader()
If rdr.Read Then
Me.message.Text = "Login Id : " + rdr(0).ToString + " " + "Password :" + rdr(1).ToString
End If
rdr.Close()
Catch ex As SqlException
message.Text = "xception " + ex.Message.ToString()
objconn.Dispose()
Finally
objconn.Close()
End Try
End Sub

Protected Sub caldob_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles caldob.SelectionChanged
Me.txtdob.Text = Me.caldob.SelectedDate

End Sub
End Class

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.