Jump to content

C# Matematiksel Işlem Yapma


CaNCaN
 Share

Recommended Posts

[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 by CaNCaN
Link to comment
Share on other sites

[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 :)

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

[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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...