private void my_Cancel_Click(object sender, EventArgs e) { InputsForm fd = new InputsForm(controler); this.Hide(); fd.setLabel(mail.Text); fd.Show(); }
private void button1_Click(object sender, EventArgs e) { string mail = (id.Text) + "@" + maskedTextBox1.Text; string pass = password.Text; string dbprovider = controler.m.getDBprovider(); String strSql = "SELECT * FROM users WHERE email= '" + mail + "'"; OleDbConnection conn = new OleDbConnection(dbprovider); if (id.Text == "" || maskedTextBox1.Text == "") { MessageBox.Show("you must add your mail"); id.Clear(); maskedTextBox1.Clear(); id.Focus(); } else { try { conn.Open(); OleDbCommand cmd = new OleDbCommand(strSql, conn); OleDbDataReader reader = cmd.ExecuteReader(); reader.Read(); string passw = reader.GetString(9); if (passw != pass) { MessageBox.Show("wrong password"); password.Clear(); password.Focus(); } else { InputsForm fi = new InputsForm(controler); this.Hide(); fi.Show(); fi.setLabel(mail); } } catch (Exception ex) { MessageBox.Show("user didn't exist or wrong mail try again"); id.Clear(); maskedTextBox1.Clear(); id.Focus(); password.Clear(); } finally { conn.Close(); } } }