'========================================================
'函数名:EScalarSqlCommand
'用于执行返回单个值的命令,
'
'========================================================
Dim sql As String = Args(0)
Try
Connections(mydb).BeginTransaction() '开始事务
Dim cmd As New SQLCommand
Dim value As Object
cmd.C
cmd.CommandText = sql
value = cmd.ExecuteScalar()
Connections(mydb).Commit '提交事务,所有操作生效
Return value
Catch ex As Exception '如果出错
Connections(mydb).Rollback() '回滚事务,撤销所有操作
End Try
,----------------------------------------------------------------
Case "型号" '以下代码校验工用具使用时限是否达标.
Dim dat As Date
Dim str As String
str="Select Max(到期更换日) Fr om {工用具领用表} Where 车牌号 ='" & e.DataRow("车牌号") & "' and 型号='" & e.NewValue & "'"
dat=Functions.Execute("EScalarSqlCommand",str)
If dat is nothing Then'没找到最大的到期更换日,怎么写判断?
end if