CaNCaN Posted March 23, 2011 Share Posted March 23, 2011 (edited) [img]http://i1103.hizliresim.com/2011/3/23/8488.jpg[/img] OleDbdata connection ile database bağladım,resimde görüldüğü gibi ekle dediğimde ekliyor ben bir buton ekledim ve datagrid attım sonuçları bir tabloda göstersin istediğim için komutları attım; benim tek istediğim Datagrid'de toplamı göstermesi sadece tabloya eklediklerimi gösteriyor toplamı bir alt satırda vermiyor ama acess veriyor. data grid attım tabloya veri eklediğimde geliyor ancak toplam kısmının biraz altında sonucu vermiyor ancak Acess içinde toplamını gösteriyor. ben Tabloda göstersin istiyorum [img]http://i1103.hizliresim.com/2011/3/23/10138.jpg[/img] Edited March 23, 2011 by CaNCaN Quote Link to comment Share on other sites More sharing options...
abdullahTR Posted March 23, 2011 Share Posted March 23, 2011 bu csharp cok zor ya asp den önce bize gösteriyolar algoritma kodları felan baya zor mantık gerektiiriyor benim fikrimce o toplam bölüne kodlara müdahale edebilirsin döngülerle felan toplatablirsin Quote Link to comment Share on other sites More sharing options...
Scarecrow Posted March 23, 2011 Share Posted March 23, 2011 Ne istediğini anlamadım biraz daha açıklarsan yardımcı olabilirim. Quote Link to comment Share on other sites More sharing options...
galetis Posted March 23, 2011 Share Posted March 23, 2011 veriyi çekerken tablodaki sayı bölümünü al ve label'a şu komutla yazdır. [code]select sum(toplam) from veritabani[/code] Quote Link to comment Share on other sites More sharing options...
CaNCaN Posted March 23, 2011 Author Share Posted March 23, 2011 resim ekleyeceğim birazdan Quote Link to comment Share on other sites More sharing options...
CaNCaN Posted March 23, 2011 Author Share Posted March 23, 2011 resim eklendi Quote Link to comment Share on other sites More sharing options...
CaNCaN Posted March 23, 2011 Author Share Posted March 23, 2011 [quote name='galetis' date='23 March 2011 - 17:12 ' timestamp='1300900923' post='982461'] veriyi çekerken tablodaki sayı bölümünü al ve label'a şu komutla yazdır. [code]select sum(toplam) from veritabani[/code] [/quote] nasıl yapacağımı anladım ustat yardımcı olabilirmisin Quote Link to comment Share on other sites More sharing options...
galetis Posted March 23, 2011 Share Posted March 23, 2011 tamam kardeş bu kodu bi sorgu yap. fetch ile zaten tek değer gelecek. onuda istediğin yere yazdır. Quote Link to comment Share on other sites More sharing options...
CaNCaN Posted March 23, 2011 Author Share Posted March 23, 2011 Şimdi verdiğin sorguyu C#'ta Label nesnesinin içine mi yazılacak ? yoksa acesss içinde tutarın orayamı yazılacak ? Quote Link to comment Share on other sites More sharing options...
galetis Posted March 23, 2011 Share Posted March 23, 2011 sqlcommand kullanmadınmı sen? kodları ver bi bakayım. Quote Link to comment Share on other sites More sharing options...
CaNCaN Posted March 23, 2011 Author Share Posted March 23, 2011 Hayır OleDbConnection tabi üstat; [code] OleDbConnection bag = new OleDbConnection("Provider=Microsoft.JET.OLEDB.4.0; Data Source=c:\\data2.mdb;"); OleDbCommand komut = new OleDbCommand(); String sira_no = textBox1.Text; String tarih = textBox2.Text; String makbuz_no = textBox3.Text; String mahal = textBox4.Text; String aciklama = textBox5.Text; bag.Open(); komut.CommandText = "insert into betontest (sira_no,tarih,makbuz_no,mahal,aciklama,tutar) values ('" + sira_no + "','" + tarih + "','" + makbuz_no + "','" + mahal + "','" + aciklama + "')"; komut.Connection = bag; komut.ExecuteNonQuery(); }[/code] Quote Link to comment Share on other sites More sharing options...
galetis Posted March 23, 2011 Share Posted March 23, 2011 [code] komut.CommandText = "select sum(tutar) from betontest"; komut.Connection = bag; OleDbDataReader reader = komut.ExecuteReader(); reader.Read(); Label1.Text = reader.ToString(); [/code] Böyle olması lazım. olmasa reader[0].ToString()'i dene. Bilgisayarda vs kurulu değil. Onun için koddan emin değilim. Quote Link to comment Share on other sites More sharing options...
CaNCaN Posted March 23, 2011 Author Share Posted March 23, 2011 olmadı hocam label 1 devreye girmedi. dediğim reader[0].ToString() code'duda denedim. 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.