DataTables("职工资料").DataCols("姓名").RaiseDataColChanged("姓名 = '" & e.DataRow("姓名") & "'")
Dim s As String
If e.DataCol.Name = "姓名" Then
Dim fdr1 As DataRow = DataTables("代码").find("部室 = '" & e.DataRow("部门") & "'")
Dim fdr2 As DataRow = DataTables("代码").find("职务 = '" & e.DataRow("职务") & "'")
s = fdr1("部室代码") + fdr2("职务代码")
Dim Names As New List(Of Object)
Names.Clear
For Each dc As Row In Tables("职工资料")
If dc("序号").length = 6 AndAlso dc("序号").substring(0,4) = s Then
Names.Add(dc("序号"))
End If
Next
If names.count > 0 Then
s = format(Functions.Execute("最大值",names.ToArray) + 1,"000000")
ElseIf names.count = 0 Then
s = s & "01"
End If
If fdr1 IsNot Nothing AndAlso fdr2 IsNot Nothing Then
e.DataRow("序号") = s
End If
End If
请问老师:应如何改才可在职工明细资料表中自动生成序号?