private void button2_Click(object sender, EventArgs e) { this.Hide(); Pag2 ss = new Pag2(); ss.Show(); }
private void button1_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\User\Documents\Visual Studio 2015\Projects\LogIn\Data.mdf;Integrated Security=True;Connect Timeout=30"); //SqlDataAdapter sda = new SqlDataAdapter("select count(*) from Donator where Nr_card_sanatate = '" + textBox1.Text + "' and Parola='" + textBox2.Text + "'", conn); SqlDataAdapter sda = new SqlDataAdapter("select count(*) from login where UserName = '******' and Password='******'", conn); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows[0][0].ToString() != "0") { this.Hide(); Pag2 ss = new Pag2(); //medic ss = new medic(); ss.Show(); } else { MessageBox.Show("Please enter correct username and password", "ErrorLogin", MessageBoxButtons.OK, MessageBoxIcon.Error); } }