我是不想加载数据而增加行时编号增加1,代码:
If e.DataCol.Name = "员工姓名" Then
If e.DataRow.IsNull("员工姓名") Then
e.DataRow("工号") = Nothing
Else
Dim cmd1 As New SQLCommand
Dim dt1 As DataTable
Dim dr As DataRow
cmd1.C
cmd1.CommandText = "SELECT * From {单号定义}"
dt1 = cmd1.ExecuteReader()
dr = dt1.find("表名='" & CurrentTable.Name & "'")
If dr IsNot Nothing Then
Dim cmd As New SQLCommand
Dim dt As DataTable
cmd.C
cmd.CommandText = "SELECT * From {销售人员档案}"
dt = cmd.ExecuteReader()
If dt.Datarows.Count>0 Then
Dim s As String = dt.Compute("Max(工号)")
Dim v As Integer = s.SubString(2)
e.DataRow("工号") = Format(v + 1,"000")
Else
e.DataRow("工号") = dr("单号定义") & "001"
End If
End If
End If
End If
帮忙看看!