Ejemplo n.º 1
0
        private void kayıtSilToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            baglanti bgln = new baglanti();

            bgln.baglan();

            DataTable    dt = new DataTable();
            DialogResult dugmesec;

            dugmesec = MessageBox.Show(this, "silmek istediğinize eminmisiniz?", "kayıt sil", MessageBoxButtons.YesNo);
            if (dugmesec == DialogResult.Yes)
            {
                SqlDataAdapter da = new SqlDataAdapter("delete from kayitbilgileri where ID =" + dataGridView1.CurrentRow.Cells[0].Value + "", bgln.baglan());
                da.Fill(dt);
                SqlCommandBuilder cb = new SqlCommandBuilder(da);
                da.Update(dt);
                displayrecords();
                bgln.baglan().Close();
            }
        }
Ejemplo n.º 2
0
        private void btngiris_Click(object sender, EventArgs e)
        {
            baglanti bgln = new baglanti();

            bgln.baglan();
            SqlCommand cm = new SqlCommand("SELECT ID FROM ornek WHERE AD='" + txtkad.Text + "' and SİFRE='" + txtsifre.Text + "'", bgln.baglan());


            SqlDataReader dr = cm.ExecuteReader();

            if (dr.Read())
            {
                MessageBox.Show("Giriş Başarılı");
                txtkad.Clear();
                txtsifre.Clear();
                mainform mfrm = new mainform();
                mfrm.lblKullaniciID.Text = dr[0].ToString();
                mfrm.Show();
            }
            else
            {
                MessageBox.Show("Giriş işlemi başarısız!");
            }
        }