以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 后台数据的调取 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=127780) |
-- 作者:foxstudent -- 发布时间:2018/11/21 22:56:00 -- 后台数据的调取 我有一张车辆加油记录表,原来都是直接加载的,因为数据量大了,我改成初始不加载。 每次登记时,要记录车辆里程,原来数据都加载时,上期里程就是读取上期的记录,我用如下的代码: If e.DataCol.name="车号" Then If e.NewValue IsNot Nothing Then Dim i As Integer=0 i=e.DataTable.Compute("Max(_identify)","车号=\'" & e.NewValue & "\' AND _identify<>\'" & E.DataRow("_identify") & "\'") If i<>0 Then Dim dr2 As DataRow=e.DataTable.find("_identify=\'" & i & "\'") If dr2 IsNot Nothing Then e.DataRow("上期里程读数")=dr2("本期里程读数") End If End If End If End If 现在改成不加载数据,那么上期里程要从sql表中提取了,请教这个代码怎么改?谢谢!
|
-- 作者:有点甜 -- 发布时间:2018/11/21 23:05:00 -- If e.DataCol.name="车号" Then
If e.NewValue IsNot Nothing Then
Dim i As Integer=0
i=e.DataTable.sqlCompute("Max(_identify)","车号=\'" & e.NewValue & "\' AND _identify<>" & E.DataRow("_identify") & "")
If i<>0 Then
Dim dr2 As DataRow=e.DataTable.sqlfind("_identify=" & i & "")
If dr2 IsNot Nothing Then
e.DataRow("上期里程读数")=dr2("本期里程读数")
End If
End If
End If
End If
|
-- 作者:foxstudent -- 发布时间:2018/11/21 23:12:00 -- 可以了,这么晚了还秒回,谢谢甜版! |