判断数据库表中是否为空,空则插入
string sqlBudget = "select b.* from BudgetApplicationAndPayout as b join WXFYLX as w on b.wid=w.id where w.ssnf='2013'"; DataTable budget = this.CommonBLL.getResult(sqlBudget); if (budget.Rows.Count == 0) { insSQL = new System.Text.StringBuilder(); insSQL.Append("insert into BudgetApplicationAndPayout (wid) select id from WXFYLX where WXFYLX.ssnf='2013'"); insSQL.Append(@"update BudgetApplicationAndPayout set firstjdje=0.00,secondlyjdje=0.00,thirdjdje=0.00,fourjdje=0.00 ,jdjeTotal=0.00,Janbk=0.00,Febbk=0.00,Marbk=0.00,Aprbk=0.00,Maybk=0.00,Junbk=0.00,Julbk=0.00,Augbk=0.00,Sepbk=0.00 ,Octbk=0.00,Novbk=0.00,Decbk=0.00,yfjeTotal=0.00");
大家帮看一下怎么不行呢。
5回答
-
鸿蒙传说
if(budget.Rows.Count
-
牧羊人nacy
我那里是复制错了,换成if(budget.Rows.Count
-
犯罪嫌疑人X
@Ole_Yao: F10调试下,应该是有具体的错误,或者程序的运行情况不跟要的逻辑相同
-
小唯快跑啊
楼上正解