16 Aralık 2014 Salı

İLAN EKLEME


EKLEME KODU


OleDbConnection bagla = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:/Users/PeckardBell/Documents/Veritabanı1.accdb");



bagla.Open();


OleDbCommand komut = new OleDbCommand("insert into emlakk(ilanbasligi,aciklamasi,turu,fiyati,binayasi,isinmaturu) values ('" + textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','"+textBox5.Text+"','"+textBox6.Text+"')", bagla);

komut.ExecuteNonQuery();

bagla.Close();




TABLOYU EKRANA GETİRME KODU

OleDbConnection bagla = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:/Users/PeckardBell/Documents/Veritabanı1.accdb");

bagla.Open();

OleDbDataAdapter komut = new OleDbDataAdapter("select * From emlakk", bagla);



DataSet dtst = new DataSet();



komut.Fill(dtst, "emlakk");

dataGridView1.DataSource = dtst.Tables["emlakk"];


           
 komut.Dispose();



 bagla.Close();
      

Hiç yorum yok:

Yorum Gönder