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