老师:下面的代码,在Access的数据库时可以运行结果准确,放在SQLserver数据库时,没有运行,请帮助修改错误。
If e.DataCol.Name="合同止期"
Dim Num As String
Dim MaxMonth As Date="1990-1-1"
Num=e.DataRow("编号")
Dim Flag As Integer=0
For Each dr As DataRow In DataTables("合同记录").Select("编号='" & Num & "'")
If dr("登记月份")>e.DataRow("登记月份")
e.DataRow("剩余天数")=Nothing
Flag=1
Else
dr("剩余天数")=Nothing
End If
Next
If Flag=0
If(e.DataRow.IsNull("合同止期") Or e.DataRow("辞退日期")<> Nothing) Then
e.DataRow("剩余天数")=Nothing
Else
Dim dt1 As Date=e.DataRow("合同止期")
Dim dt2 As Date=Date.Today
Dim Result As TimeSpan=dt1-dt2
e.DataRow("剩余天数")=Result.Days
End If
End If
End If