private void btadmin_Click(object sender, EventArgs e) { this.Hide(); SignIn_Form s = new SignIn_Form(); s.ShowDialog(); }
private void clicklog_Click(object sender, EventArgs e) { this.Hide(); SignIn_Form si = new SignIn_Form(); si.ShowDialog(); }
private void buttonsign_Click(object sender, EventArgs e) { string ConnectionString = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=E:\CoffeeShopDB.mdf;Integrated Security=True;Connect Timeout=30"; string sql = string.Format("select * from TableSignIn where UserName = '******' and Password = '******'", txtmail.Text, txtpass.Text); SqlConnection conn = new SqlConnection(ConnectionString); SqlCommand sqlcmd = new SqlCommand(sql, conn); DataTable dt = new DataTable(); sqlcmd.Connection.Open(); dt.Load(sqlcmd.ExecuteReader()); if (dt.Rows.Count > 0) { MessageBox.Show("Log in success!!"); MessageBox.Show(dt.Rows[0][0].ToString()); SignIn_Form signInfo = new SignIn_Form(dt.Rows[0][0].ToString()); signInfo.Show(); this.Hide(); } else { MessageBox.Show("Error!!"); } sqlcmd.Connection.Close(); }