private void btnanasayfa_Click(object sender, EventArgs e) { anasayfa anasayfa = new anasayfa(); anasayfa.Show(); this.Hide(); }
private void tbgiris_Click(object sender, EventArgs e) { SqlConnection con; SqlCommand cmd; SqlDataReader dr; string user = tbkadi.Text; string pass = tbsifre.Text; con = new SqlConnection(@"Data Source=LAPTOP-D2QGEVCK\SQLEXPRESS;Initial Catalog=E-Ticaret;Integrated Security=True;User ID=aleyna;Password=123123"); cmd = new SqlCommand(); con.Open(); cmd.Connection = con; cmd.CommandText = "SELECT * FROM tbl_kullanici where KullaniciAdi='" + tbkadi.Text + "' AND Sifre='" + tbsifre.Text + "'"; dr = cmd.ExecuteReader(); if (dr.Read()) { anasayfa anasayfa = new anasayfa(); anasayfa.Show(); } else { MessageBox.Show("Giriş hatalı"); } con.Close(); }