Dim ary() As String = Functions.Execute("Xueqi")
cmd.C
cmd.CommandText = "select * F rom {教工基本信息} Where 教工编号 = '" & e.Form.Controls("教工编号").Text & "' And 离职日期 Is Null"
dt = cmd.ExecuteReader(True) '记得将参数设置为True
Dim dr As DataRow
If dt.DataRows.Count = 0 Then
Dim max As String = DataTables("教工基本信息").SQLCompute("Max(教工编号)","教工编号 Like '" & ary(2) & "%'")
If max = "" Then
e.Form.Controls("教工编号").text= ary(2) & "01"
Else
Dim v As Integer = max.SubString(6,2)
e.Form.Controls("教工编号").text= ary(2) & format(v +1,"00")
End If
dr = DataTables("教工基本信息").AddNew()
dr("录入人") = _UserXingming
dr("录入日期") = Format(Date.Now,"yyyy-MM-dd")
Else If dt.DataRows.Count > 0 Then
dr = dt.DataRows(0)
dr("修改人") = _UserXingming
dr("修改日期") = Format(Date.Now,"yyyy-MM-dd")
End If
Dim names() As String = {"中国","美国","日本","俄罗斯"}
For Each name As String In names
dr(name) = e.Form.Controls(name).text
Next
Tables("教工基本信息").Save()