muratboy31 Posted February 24, 2016 Share Posted February 24, 2016 (edited) Arkadaşlar merhaba, bir tablo içinde 2 alanda veri tutuyorum: puan, tarih puanlama sisteminde sadece 3 seçenek var, 1,2,3 diye kayıtta tutuyorum. istediğim o tarihteki aynı puanları chart serisi ile göstersin, aşağıdaki gösterdiğimde kodda sürekli üst üste topluyor günleri, ben hergünü ayrı ayrı toplasın istiyorum, bunu nasıl yapabilirim acaba ? Edited February 25, 2016 by muratboy31 Quote Link to comment Share on other sites More sharing options...
KintaRo Posted February 24, 2016 Share Posted February 24, 2016 sorgunun sonuna GROUP BY date ekleyip dener misiniz? Quote Link to comment Share on other sites More sharing options...
muratboy31 Posted February 24, 2016 Author Share Posted February 24, 2016 yine aynı, sürekli üstüne ekleyerek chart oluşturuyor. bir şekilde sorgudan gelen tarih değiştiğinde iyi = 0, orta = 0, kotu = 0; değişkenlerini tekrardan sıfırlaması lazım ama yapamadım. Quote Link to comment Share on other sites More sharing options...
mbayrak Posted February 24, 2016 Share Posted February 24, 2016 Çünkü döngü içerisinde tarihle ilgili bir kıyaslama yapmadan iyi++ satırı ile sürekli üstüne toplama yapıyorsun. GROUP BY date ekle ve döngünü içerisinde değişen tarihi kontrol ederek sıfırlama işlemi yapman gerekir Quote Link to comment Share on other sites More sharing options...
muratboy31 Posted February 24, 2016 Author Share Posted February 24, 2016 döngü içinde tarih kontrolünü nasıl yapabilirim ? ilk tarihi döngü içinde aldığımda döngü başa dönünce aynı tarihi birdaha alıyor yane kontrol yapamiyorum. Quote Link to comment Share on other sites More sharing options...
Editor pairs Posted February 24, 2016 Editor Share Posted February 24, 2016 int iyi = 0, orta = 0, kotu = 0; while (reader.Read()) { yerine while (reader.Read()) { int iyi = 0, orta = 0, kotu = 0; şeklnde kullan Quote Link to comment Share on other sites More sharing options...
muratboy31 Posted February 24, 2016 Author Share Posted February 24, 2016 (edited) aşağıdadır. Edited February 26, 2016 by muratboy31 Quote Link to comment Share on other sites More sharing options...
mbayrak Posted February 26, 2016 Share Posted February 26, 2016 Bu şekilde dener misin baglanti.Open(); MySqlCommand command = baglanti.CreateCommand(); command.CommandText = "SELECT COUNT(*), date, link_id FROM ipaddress_vote_map WHERE (date BETWEEN '" + yil + "-" + ay + "-" + gun + " 00:00:00' AND '" + yil2 + "-" + ay2 + "-" + gun2 + " 23:59:59') group by date(date), link_id"; MySqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { switch (reader.GetInt32(2)) { case 1: seriesIYI.Points.Add(new DevExpress.XtraCharts.SeriesPoint(reader.GetDateTime(1), reader.GetInt32(0))); break; case 2: seriesORTA.Points.Add(new DevExpress.XtraCharts.SeriesPoint(reader.GetDateTime(1), reader.GetInt32(0))); break; case 3: seriesKOTU.Points.Add(new DevExpress.XtraCharts.SeriesPoint(reader.GetDateTime(1), reader.GetInt32(0))); break; } } reader.Close(); baglanti.Close(); Quote Link to comment Share on other sites More sharing options...
muratboy31 Posted February 26, 2016 Author Share Posted February 26, 2016 Çok teşekkürler mbayrak, oldu. 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.