以下是引用实话实说在2011-6-7 18:52:00的发言:
麻烦将代码完整的写一遍吧,我试了一下17楼+21楼代码,还是有点问题.先谢了.
看来你并没有理解代码,要不你都这么长时间的老狐了,应该可以搞定呀: 呵呵,批评一次。。。
Dim d5 As Date = e.DataRow("日期")
Dim StartDate As Date
Dim EndDate As Date
Dim Month As Integer = d5.Month
Dim Year As Integer = d5.Year
StartDate = New Date(Year,Month,1)
EndDate = New Date(Year,Month,Date.DaysInMonth(Year,Month))
If e.DataCol.Name = "日期" Then
If e.DataRow.IsNull("日期") Then
e.DataRow("第三列") = Nothing
Else
If e.NewValue <> Nothing And e.DataRow("第三列") = Nothing Then
e.DataRow("第三列") ="AA" & format(e.NewValue,"yyMMdd") ‘只修改了这个地方···
'CStr(e.NewValue).Remove(0,2).Remove(2,1).Remove(4,1) 'And 日期 = #" & d5 & "#
Dim drs As List(of DataRow) = e.DataTable.Select("日期 >= #" & StartDate & "# And 日期 <= #" & EndDate & "# And 日期 = #" & d5 & "# ")
For i As Integer = 0 To drs.Count - 1
If drs(i)("第三列").Length = 8 Then
drs(i)("第三列") = e.DataRow("第三列") & format(i+1,"000")
End If
Next
End If
End If
End If
[此贴子已经被作者于2011-6-7 19:08:28编辑过]