private void Fill_DG() { try { DB db = new DB(); db.AddCondition("pay_date", From_DTP.Value.Value.Date, false, ">=", "SD"); db.AddCondition("pay_date", To_DTP.Value.Value.Date, false, "<=", "ED"); DataSet ds = db.SelectSet(@"select * from payments p join persons pp on p.pay_per_id=pp.per_id where pay_trn_id=5 and pay_date>=@SD and pay_date<=@ED; select * from payments p join persons pp on p.pay_per_id=pp.per_id where pay_trn_id=6 and pay_date>=@SD and pay_date<=@ED"); ds.Tables[0].Rows.Add( null, null, ds.Tables[0].Compute("Sum(pay_value)", ""), "الاجمالى"); ds.Tables[1].Rows.Add( null, null, ds.Tables[1].Compute("Sum(pay_value)", ""), "الاجمالى"); Income_DG.ItemsSource = ds.Tables[0].DefaultView; Outcome_DG.ItemsSource = ds.Tables[1].DefaultView; } catch { } }