namespace Restaurant_Billing
{
public partial class changepassword : Form
{
public changepassword()
{
InitializeComponent();
}
SqlConnection cn = new SqlConnection();
SqlCommand cm = new SqlCommand();
private void button2_Click(object sender, EventArgs e)
{
Close();
}
private void button1_Click(object sender, EventArgs e) {
txtusername.Text = globalclass.m_globalvar;
txtpasscurrent.Text = globalclass.m_globalvar;
string username = txtusername.Text;
string password = txtpasscurrent.Text;
string newpassword = textpassnew.Text;
string confirmnewpassword = textpassconfirm.Text;
if (textpassnew.Text == textpassconfirm.Text)
{
cm = new SqlCommand("update tbluser set Pw = '" + textpassnew.Text + "' where U_name = '" + txtusername.Text + "'");
cm.Connection = cn;
cm.ExecuteNonQuery();
MessageBox.Show("password has been changed");
}
else
{
MessageBox.Show("some errors!! dawg correct it!!");
txtpasscurrent.Focus();
}
}
private void changepassword_Load(object sender, EventArgs e)
{
this.txtusername.Text = globalclass.m_globalvar;
cn = new SqlConnection(@"server=UMESHINATOR-PC\SQLEXPRESS;integrated security=true;database=nec");
cn.Open();
}
}
}