DataRow[] rows = ds.Tables[1].Select("(FinanceType=2) and (AuditStatus=1)");
decimal Price = 0; ;
for (int i = 0; i < rows.Length; i++)
{
Price += decimal.Parse(rows[i]["FinanceMoney"].ToString());
}
DataRow[] Brows = ds.Tables[1].Select("((FinanceType=1) or (FinanceType=3)) and (AuditStatus=1)");
decimal NesPrice = 0;
for (int j = 0; j < Brows.Length; j++)
{
NesPrice += decimal.Parse(Brows[j]["FinanceMoney"].ToString());
}
this.L12.Text = Price.ToString()+"元";
this.L14.Text = NesPrice.ToString()+"元";
我这样写性能好像很不好!要怎么改呢!因为两次去FOR数据库!性能底下!
decimal Price = 0; ;
for (int i = 0; i < rows.Length; i++)
{
Price += decimal.Parse(rows[i]["FinanceMoney"].ToString());
}
DataRow[] Brows = ds.Tables[1].Select("((FinanceType=1) or (FinanceType=3)) and (AuditStatus=1)");
decimal NesPrice = 0;
for (int j = 0; j < Brows.Length; j++)
{
NesPrice += decimal.Parse(Brows[j]["FinanceMoney"].ToString());
}
this.L12.Text = Price.ToString()+"元";
this.L14.Text = NesPrice.ToString()+"元";
我这样写性能好像很不好!要怎么改呢!因为两次去FOR数据库!性能底下!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货