private void btNavInvCounts2_Click(object sender, EventArgs e) { this.Hide(); FormInventoryCounts f2 = new FormInventoryCounts(); f2.ShowDialog(); }
private void loginbutton_Click(object sender, EventArgs e) { //Kim's Connection: //SqlConnection con = new SqlConnection(); //con.ConnectionString = @"Data Source=DESKTOP-28THE6N\MSSQLSERVER2017;Initial Catalog=Northwind;Integrated Security=True"; SqlConnection con = new SqlConnection(@"Data Source =SIKEISHAS-PC\SQLEXPRESS;Initial Catalog=Northwind;Integrated Security = True"); con.Open(); string username = usernametextBox.Text; string password = passwordtextBox.Text; SqlCommand cmd = new SqlCommand("select username, password from login where username='******'and password='******'", con); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count > 0) { this.Hide(); FormInventoryCounts f2 = new FormInventoryCounts(); f2.ShowDialog(); } else { MessageBox.Show("Invalid Login. Check username and password."); } con.Close(); }