lamont Posted February 28, 2015 Share Posted February 28, 2015 arkadaşlar Odbc Access Veritabanındaki Bilgiyi Listbox ile Çekerken aşagıdaki hatayı alıyorum Veri ekleme veri Silmede sorun yok ama Access ten veriyi listbox atamadım yardımcı olabilirmsiniz OdbcConnection data = new OdbcConnection("DSN=deneme"); private void button1_Click(object sender, EventArgs e) { string ver; ver = textBox1.Text; OdbcCommand veri = new OdbcCommand("insert into Tablo1(alan)values('"+ver+"')",data); veri.ExecuteNonQuery(); } private void button2_Click(object sender, EventArgs e) { int sil; string v = textBox2.Text; OdbcCommand veri = new OdbcCommand("delete from Tablo1 where alan='"+v+"'", data); sil=veri.ExecuteNonQuery(); MessageBox.Show(sil + "Kayıt Silindi"); } private void Form1_Load(object sender, EventArgs e) { data.Open(); label1.Text = "Baglandı.."; } private void button3_Click(object sender, EventArgs e) { OdbcCommand veri = new OdbcCommand("select * from Tablo1",data ); OdbcDataReader oku = veri.ExecuteReader(); while (oku.Read()) { listBox1.Items.Add(oku["Tablo1"].ToString()); } } } } Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted February 28, 2015 Editor Share Posted February 28, 2015 listBox1.Items.Add(oku["Tablo1"].ToString()); Buradaki tablo1 yerine o tablodaki kolonun ismini yazacaksın. Mesela Tablo1 adında tablomuz olsun. bunun içi ID,AD,SOYAD,DOGUMTARIHI gibi olsun sen burdan sadece adları çekeceksen. oku["AD"].ToString() demen lazım Quote Link to comment Share on other sites More sharing options...
lamont Posted February 28, 2015 Author Share Posted February 28, 2015 (edited) Pairs tamamını nasıl çekebilirim Pairs Tüm Kolonu Listbox İle Çagırabiliyormuyuz Edited February 28, 2015 by lamont Quote Link to comment Share on other sites More sharing options...
MostWanted Posted February 28, 2015 Share Posted February 28, 2015 Bu konu "Yazılım" forumundan "C#" forumuna taşınmıştır. Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted February 28, 2015 Editor Share Posted February 28, 2015 Normal Listbox datasource desteklemiyor bildiğim kadarıyla. Mecburen while ile read ederek eklemen gerekiyor. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.