Hi,
I m trying update password in database using asp.net with c#.
I have three text box in my aspx page
Old password
New password
confirm password
i m using following code but its not resolving
step1 - this code in aspx.cs page
[code=cpp]
protected void btnchangepwd_Cl ick(object sender, EventArgs e)
{
try
{
if (IsValid)
{
SqlCommand cmd = new SqlCommand("HMS FetchPassword", con);
cmd.CommandType = CommandType.Sto redProcedure;
SqlDataReader dr;
con.Open();
cmd.Parameters. Add("@Pwd", this.txtoldpass .Text);
dr = cmd.ExecuteRead er();
if (dr.Read()==nul l)
{
if(txtoldpass.T ext==txtnewpass .Text)
{
cmd.CommandText ="HMSSP_UpdateP assword";
cmd.CommandType =CommandType.St oredProcedure;
cmd.Parameters. Add("@Pwd",this .txtoldpass.Tex t);
// cmd.ExecuteNonQ uery();
lblmessage.Visi ble=true;
lblmessage.Text ="Your Password Sucessfully changed.";
}
else
{
lblmessage.Visi ble = true;
lblmessage.Text = "Please enter correct Password ";
}
dr.Close();
con.Close();
}
}
}
catch (Exception ex)
{
Response.Write( ex.Message);
}
}[/code]
--------------------------------------------------------------------
step-2
[code=sql]
CREATE procedure [dbo].[HMSSP_FetchPwd]
(
@Name varchar(200)
)
As
SET NOCOUNT ON
begin
select Pwd from TblHMSOwner_Reg where Name=@Name
End
create procedure [dbo].[HMSSP_UpdatePas sword]
(
@Name Varchar(50),
@Pwd Varchar(50)
)
As
SET NOCOUNT ON
begin
update TblHMSOwner_Reg
set Pwd=@Pwd where Name=@Name
End[/code]
hi if anyone have idea about it or have code then please help me
thanks in advance
I m trying update password in database using asp.net with c#.
I have three text box in my aspx page
Old password
New password
confirm password
i m using following code but its not resolving
step1 - this code in aspx.cs page
[code=cpp]
protected void btnchangepwd_Cl ick(object sender, EventArgs e)
{
try
{
if (IsValid)
{
SqlCommand cmd = new SqlCommand("HMS FetchPassword", con);
cmd.CommandType = CommandType.Sto redProcedure;
SqlDataReader dr;
con.Open();
cmd.Parameters. Add("@Pwd", this.txtoldpass .Text);
dr = cmd.ExecuteRead er();
if (dr.Read()==nul l)
{
if(txtoldpass.T ext==txtnewpass .Text)
{
cmd.CommandText ="HMSSP_UpdateP assword";
cmd.CommandType =CommandType.St oredProcedure;
cmd.Parameters. Add("@Pwd",this .txtoldpass.Tex t);
// cmd.ExecuteNonQ uery();
lblmessage.Visi ble=true;
lblmessage.Text ="Your Password Sucessfully changed.";
}
else
{
lblmessage.Visi ble = true;
lblmessage.Text = "Please enter correct Password ";
}
dr.Close();
con.Close();
}
}
}
catch (Exception ex)
{
Response.Write( ex.Message);
}
}[/code]
--------------------------------------------------------------------
step-2
[code=sql]
CREATE procedure [dbo].[HMSSP_FetchPwd]
(
@Name varchar(200)
)
As
SET NOCOUNT ON
begin
select Pwd from TblHMSOwner_Reg where Name=@Name
End
create procedure [dbo].[HMSSP_UpdatePas sword]
(
@Name Varchar(50),
@Pwd Varchar(50)
)
As
SET NOCOUNT ON
begin
update TblHMSOwner_Reg
set Pwd=@Pwd where Name=@Name
End[/code]
hi if anyone have idea about it or have code then please help me
thanks in advance
Comment