以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  日期的问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=90763)

--  作者:天蝉一线
--  发布时间:2016/9/21 11:34:00
--  日期的问题
Dim y As Integer = Date.Today.Year
Dim nf As Date = DataTables("大额资金支出备案明细表").Datarows("申报备案时间")
Dim cnt1 As Integer = DataTables("大额资金支出备案明细表").Compute("Count(_Identify)","审核结果 = \'审核未通过\' And 过会结果=\'\'")
Dim cnt2 As Integer = DataTables("大额资金支出备案明细表").Compute("Count(_Identify)","审核结果 =\'审核通过\' and 过会结果=\'\'")
Dim cnt3 As Integer = DataTables("大额资金支出备案明细表").Compute("Count(_Identify)","过会结果 = \'通过\' And nf.year =\'" & y & "\'")
Dim cnt4 As Integer = DataTables("大额资金支出备案明细表").Compute("Count(_Identify)","过会结果 = \'未通过\' And nf.year =\'" & y & "\'")
e.Form.Controls("shtg1").value = "审核通过(" & cnt2 & ")条"  
e.Form.Controls("shtg2").value ="审核未通过(" & cnt1 & ")条"

错误信息:datarow无法转换成date

--  作者:有点蓝
--  发布时间:2016/9/21 11:44:00
--  
Dim nf As Date = DataTables("大额资金支出备案明细表").Datarows(0)("申报备案时间")
--  作者:天蝉一线
--  发布时间:2016/9/21 12:02:00
--  
Dim cnt3 As Integer = DataTables("大额资金支出备案明细表").Compute("Count(_Identify)","过会结果 = \'通过\' And nf.year =\'" & y & "\'")
Dim cnt4 As Integer = DataTables("大额资金支出备案明细表").Compute("Count(_Identify)","过会结果 = \'未通过\' And nf.year =\'" & y & "\'")

划横线的地方系统认为没有这个列,这个列应该是“申报备案时间”,但是我用[申报备案时间].year,系统提示没有定义year,不知道该怎么办了

--  作者:有点蓝
--  发布时间:2016/9/21 14:12:00
--  
改为sqlCompute,可以这样用

Dim cnt3 As Integer = DataTables("大额资金支出备案明细表").sqlCompute("Count(_Identify)","过会结果 = \'通过\' And year(申报备案时间) =" & y )
Dim cnt4 As Integer = DataTables("大额资金支出备案明细表").sqlCompute("Count(_Identify)","过会结果 = \'未通过\' And year(申报备案时间) =" & y )