Suppose you have 2 textbox named txtNewPassword and txtConfirmedPassword.
After feeding these two textboxes, On the Save Button Click Event Do The Following:
1. Fetch The Record of current user in the datatable.
2. If recordcount > 0 then fire an update query to update the current user's new password.
Sample Code:
if (txtNewPassword.Text == txtConfirmPassword.Text)
{
mSQL = "SELECT * FROM TableName WHERE user_name = '" + txtUserName.Text + "' AND password = '" + txtPassword.Text + "'";
mDT_Save = mDBHelper.GetTable(mSQL);
if (mDT_Save.Rows.Count > 0)
{
for (int i = 0; i < mDT_Save.Rows.Count; i++)
{
mSQL = "UPDATE TableName SET password = '" + txtConfirmPassword.Text + "' WHERE user_name = '" + Convert.ToString(mDT_Save.Rows[i]["user_name"]) + "'";
mDBHelper.ExecuteSQLNonQuery(mSQL);
}
MessageBox.Show("Password Changed Successfully");
txtPassword.Text = txtConfirmPassword.Text;
return;
}
else
{
MessageBox.Show("User Not Found");
return;
}
}
Hope through this sample code you will get an idea