下面这段代码不能自动计算出编号,请帮忙修改下,谢谢
Dim dt As DataTable = DataTables("表A")
Dim drName As String = "第一列"
Dim left As String = "SN"
Dim fomart As String = "0000"
Dim max As String
Dim idx As Integer
max = dt.Compute("Max(" & drName & ")")
If max > "" Then
idx = CInt(max.SubString(left.Length, fomart.Length)) + 1
Else
idx = 1
End If
msgbox(left & Format(idx, fomart))