-- 作者:yyzlxc
-- 发布时间:2011/12/4 15:01:00
-- [求助]代码出错(已解决)
一段日期计算代码,在DataColChanged中,保存时出错,应该如何修改,请各位老师帮助指教,谢谢!!
(内部表)
Dim mydate As Date = Forms("a").Controls("DateTimePicker1").Text Dim y As Integer = mydate.Year Dim m As Integer = mydate.Month Dim Days As Integer = Date.DaysInMonth(y,m) Dim yc As Date = New Date(y,m,1) \'月初日期 Dim yd As Date = New Date(y,m,Days) \'月底日期 \'当月天数 Select Case e.DataCol.Name Case "编号" Dim dr As DataRow = e.DataRow If dr.IsNull("进厂日期") OrElse dr.IsNull("离厂日期") Then dr("当月天数") = 0 Else If dr("进厂日期") <= #" & yc & "# And dr("离厂日期") > #" & yd & "# Then dr("当月天数") = #" & Days & "# Else dr("当月天数") = 0 End If End If End Select
此主题相关图片如下:k.png
[此贴子已经被作者于2011-12-4 16:19:48编辑过]
|