sql语句 select DPAvgPoint from cardp where DPAvgPoint >3
数据库中类型 DPAvgPoint 为 decimal(18, 2)
protected int customerTotal = 0;
DataSet dsCustomer = Car_DPService.GetDPTotalData(1);
DataTable dt = dsCustomer.Tables[0];
foreach (DataRow dr in dt.Rows)
{
for (int i = 0; i < dt.Columns.Count; i++)
{
customerTotal = int.Parse(dt.ToString());
}
} 想要查询 数据表中 dpavgpoint 大于三的值 并累加 给 变量 customerTotal
请问怎么写 谢谢!
数据库中类型 DPAvgPoint 为 decimal(18, 2)
protected int customerTotal = 0;
DataSet dsCustomer = Car_DPService.GetDPTotalData(1);
DataTable dt = dsCustomer.Tables[0];
foreach (DataRow dr in dt.Rows)
{
for (int i = 0; i < dt.Columns.Count; i++)
{
customerTotal = int.Parse(dt.ToString());
}
} 想要查询 数据表中 dpavgpoint 大于三的值 并累加 给 变量 customerTotal
请问怎么写 谢谢!
....
table.Compute("sum(dpavgpoint)", "dpavgpoint > 3");
{
customerTotal +=dr["DPAvgPoint "]
}
{
customerTotal +=dr["DPAvgPoint "]
}
或customerTotal += (int)dr[""]
还可使用datatable.Compute