Şekil 2
private void Form1_Load(object sender, EventArgs e)
{
System.Data.OleDb.OleDbConnection baglan = new System.Data.OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source= bilgi.mdb ;");
System.Data.OleDb.OleDbDataAdapter adp = new System.Data.OleDb.OleDbDataAdapter();
adp.SelectCommand = new System.Data.OleDb.OleDbCommand("Select * From personel", baglan);
System.Data.OleDb.OleDbCommandBuilder CB = new System.Data.OleDb.OleDbCommandBuilder(adp);
System.Data.DataSet ds = new System.Data.DataSet();
baglan.Open();
adp.Fill(ds);
dataGridView1.Columns.Add("id", "Kayıt No");
dataGridView1.Columns.Add("Kullanici_Adi", "Kullanıcı Adı");
dataGridView1.Columns.Add("Sifre", "Şifre");
dataGridView1.Columns.Add("Ad", "Adı");
dataGridView1.Columns.Add("Soyad", "Soyadı");
dataGridView1.Columns["id"].DataPropertyName = "id";
dataGridView1.Columns["Kullanici_Adi"].DataPropertyName = "Kullanici_Adi";
dataGridView1.Columns["Sifre"].DataPropertyName = "Sifre";
dataGridView1.Columns["Ad"].DataPropertyName = "Ad";
dataGridView1.Columns["Soyad"].DataPropertyName = "Soyad";
dataGridView1.DataSource = ds.Tables[0];
baglan.Close();
}
//Bir sonraki makalede buluşmak üzere. Bahadır ŞAHİN
0 comments:
Yorum Gönder