コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                baglan.Open();
                SqlCommand komut = new SqlCommand("Select *from giris where ad=@adi AND sifre=@sifresi", baglan);
                komut.Parameters.AddWithValue("@adi", textBox1.Text.Trim());
                komut.Parameters.AddWithValue("@sifresi", textBox2.Text.Trim());
                DataTable      dt = new DataTable();
                SqlDataAdapter da = new SqlDataAdapter(komut);
                da.Fill(dt);
                if (dt.Rows.Count > 0)
                {
                    butonLedYak af = new butonLedYak();
                    af.Show();
                    this.Hide();
                }
                else
                {
                    if (textBox1.Text != "A")
                    {
                        MessageBox.Show("Kullanıcı Adı veya Şifre Hatalı");
                    }
                    baglan.Close();
                }
            }

            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }
コード例 #2
0
        //  SqlConnection baglan = new SqlConnection("Data Source=casper\\sqlexpress;Initial Catalog=gazSensoru;Integrated Security=True");
        private void Veritabanı_Load(object sender, EventArgs e)
        {
            butonLedYak frm = new butonLedYak();

            frm.verileriGoster();
        }