private void button1_Click(object sender, EventArgs e) { if (textUserName.Text == "" || textPassword.Text == "") { MessageBox.Show("please fill mandatory fields"); } else if (textPassword.Text != textConfPassword.Text) { MessageBox.Show("pass do not match"); } else { using (SqlConnection sqlConn = new SqlConnection(ConnectionString)) { sqlConn.Open(); SqlCommand sqlCmd = new SqlCommand("UserAdd", sqlConn); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.Parameters.AddWithValue("@FirstName", textFirstName.Text.Trim()); sqlCmd.Parameters.AddWithValue("@LastName", textLastName.Text.Trim()); sqlCmd.Parameters.AddWithValue("@UserName", textUserName.Text.Trim()); sqlCmd.Parameters.AddWithValue("@Password", textPassword.Text.Trim()); sqlCmd.ExecuteNonQuery(); MessageBox.Show("Registration is successfull"); this.Hide(); Sign_in sg = new Sign_in(); sg.ShowDialog(); sqlConn.Close(); } } }
private void button1_Click(object sender, EventArgs e) { this.Hide(); Sign_in sg = new Sign_in(); sg.ShowDialog(); }