以前用下列代码自动编号:
'Dim max As String
'max = e.DataTable.Compute("max(产品ID)")
'If max > "" Then
'Dim idx As Integer
'idx = CInt(max.SubString(3,6)) + 1
'e.DataRow("产品ID") = "SMP" & Format(idx,"000000")
'Else
'e.DataRow("产品ID") = "SMP" & "000001"
'End If
为避免自动编号网络环境下不重复,使用如下代码:
e.DataRow.Save
e.DataRow("产品ID") = "SMP" & Format(e.DataRow("_Identify"), "000000")
问题是第二种编号产生的编号同第一种以前添加的代码重复了, 怎么办?