Aman Jen

Aman Jen

  • NA
  • 141
  • 40.5k

Update password Not working

Sep 6 2013 12:53 AM

cn.Open();
cmd.Connection = cn;
cmd.CommandText = "Select * From LoginUser Where User_Id= '" + TB_User.Text + "'  And Pass_W='" + TB_Pass.Text + "'";
SqlDataReader dr = default(SqlDataReader);
dr = cmd.ExecuteReader();
if (dr.HasRows) {
dr.Read();

if ((dr.Item("User_Id").ToString == TB_User.Text) & (dr.Item("Pass_W").ToString == TB_Pass.Text)) {
dr.Close();
if (TB_New_P.Text == TB_Con_P.Text) {
cmd.CommandText = "Update LoginUser Set Pass_W='" + TB_New_P.Text + "' Where User_Id='" + TB_User.Text + "'";
cmd.ExecuteNonQuery();
Interaction.MsgBox("Password Update Sucess");
} else {
Interaction.MsgBox("Password Didnot match");
}

}
}

In VB we have dr.item stuff...so therein its woking fine...

but not in C#

Plz help


Answers (1)