我有张表, 【级1code】需要自动编码DataColChanged事件代码设置为:
Select e.DataCol.Name
Case "类别code"
If e.DataRow.IsNull("类别code") Then
e.DataRow("级1code") = Nothing
Else
Dim lb As String = e.DataRow("类别code")
If e.DataRow("级1code").StartsWith(lb) = False
Dim max As String
Dim idx As Integer
max = e.DataTable.Compute("Max(级1code)", "类别code ='" & lb & "' And [_Identify] <> " & e.DataRow("_Identify"))
If max > "" Then
idx = CInt(max.Substring(5,2))+1
Else
idx = 1
End If
e.DataRow("级1code") = lb & Format(idx, "00")
End If
End If
End Select
但不成功,
![dvubb 图片点击可在新窗口打开查看](skins/default/filetype/png.gif)
此主题相关图片如下:企业微信截图_17296421571745.png
![dvubb 图片点击可在新窗口打开查看](UploadFile/2024-10/202410238114857691.png)
需要怎么修改,