回复18楼,datarowadded事件输入e.DataRow("编制日") = Date.now肯定是没问题,请认真测试。
如果是订单号没有计算,修改代码,如
Select Case e.DataCol.name
Case "编制日"
If e.DataRow.IsNull("编制日") Then
e.DataRow("订单号") = Nothing
Else
Dim bh As String = Format(e.DataRow("编制日"),"yyMMdd") '取得编号的6位前缀
If e.DataRow("订单号").StartsWith(bh) = False '如果编号的前6位不符
Dim idx As Integer
Dim drs As List(Of DataRow)
drs = e.DataTable.Select("编制日 >= #" & e.DataRow("编制日").Date & "# and 编制日 < #" & e.DataRow("编制日").Date.adddays(1) & "#", "_Identify") '找出所有符合条件的行
For i As Integer = 0 To drs.count-1
If drs(i)("_Identify") =e.DataRow("_Identify")
idx = i + 1
Dim ac As Integer = 65
Dim str As String = ""
Do While True
idx = idx - 1
Dim m As Integer = idx Mod 26
idx = idx \ 26
str = str.Insert(0,chr(65+m))
If idx = 0 Then
Exit Do
End If
Loop
drs(i)("订单号") = bh & str
End If
Next
End If
End If
End Select