<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:PadmaSMSConnectionString %>"
SelectCommand="SELECT [EmailID], [Password],[CnPassword] FROM [Registration] WHERE [EmailID] = @EmailID"
UpdateCommand="UPDATE [Registration] SET [Password] = @password WHERE [EmailID] = @EmailID">
<SelectParameters>
<asp:SessionParameter Name="EmailID" SessionField="User" />
</SelectParameters>
<UpdateParameters>
<asp:ControlParameter ControlID="txtnewpass" Name="password"
PropertyName="Text" Type="String" />
<asp:Parameter Name="EmailID" />
</UpdateParameters>
</asp:SqlDataSource>
protected void BtnChangePass_Click(object sender, EventArgs e)
{
try
{
con = new SqlConnection(ConfigurationManager.ConnectionStrings["PadmaSMSConnectionString"].ConnectionString);
com = new SqlCommand("select * from Registration where EmailID=@id", con);
com.Parameters.AddWithValue("@id", Session["User"].ToString());
con.Open();
dataread = com.ExecuteReader();
dataread.Read();
if (dataread.GetString(6) == this.Txtoldpass.Text)
{
this.SqlDataSource1.Update();
this.Label1.Text = "Your Password has been changed!";
}
else
{
this.Label1.Text = "Please Enter Correct Old Password";
}
con.Close();
}
catch (Exception ex)
{
Label1.Text = ex.Message;
}
}
I need help, please tell me the problem of this code. Thank u