试试这个 Dim dr As DataRow dr = DataTables("职务变动基础信息").Find("[序号] > 0") Dim Val As string Val= e.Form.Controls("姓名").Value Dim Vbl As string Vbl= e.Form.Controls("身份证号").Value if Val = "" then MessageBox.Show("你未录入需要变动职务人员的姓名!!!", "提示", MessageBoxButtons.OK,MessageBoxIcon.Information) Return '终止代码的执行 Else if Vbl = "" then MessageBox.Show("你未录入需要变动职务人员的身份证号!!!", "提示", MessageBoxButtons.OK,MessageBoxIcon.Information) Return '终止代码的执行 End If if Val > "" AndAlso DataTables("职务变动基础信息").Select("[姓名] = '" & val & "'").Count > 0 then if Vbl > "" AndAlso DataTables("职务变动基础信息").Select("[身份证号] = '" & val & "'").Count > 0 then MessageBox.Show("在职务变动基础信息表中已有该人员的基础信息,不需要你重新录入!!!","提示",MessageBoxButtons.OK,MessageBoxIcon. Information) If Vbl IsNot Nothing Then Dim wz As long = Tables("职务变动基础信息").FindRow(dr) If wz >= 0 Then Tables("职务变动基础信息").Position = wz End If End If Forms("职务变动人员基础信息录入").Open() End If MessageBox.Show("在职务变动基础数据表中没有查询到该姓名的人员,我们将在调资基础数据表中查询读入该人员的基础信息!!!", "提示", MessageBoxButtons.OK,MessageBoxIcon.Information) End If dim f As New Filler f.SourceTable = DataTables("调资基础数据") '指定数据来源 f.SourceCols = "序号,单位名称,姓名,身份证号,性别,出生时间,参加工作时间,职务" '指定数据来源列 f.DataTable = DataTables("职务变动基础信息") '指定数据接收表 f.DataCols = "序号,单位名称,姓名,身份证号,性别,出生时间,参加工作时间,变动前职务" '指定数据接收列 f.ExcludeExistValue = "true" f.ExcludeNullValue = "true" With e.Form.Controls("单位名称") If .Value IsNot Nothing Then f.Filter= "[身份证号]= '" & .Value & "'" f.Fill() '填充数据 MessageBox.Show("你录入的职务变动人员,其基础信息已从调资基础数据表读入到职务变动基础信息表!!!", "提示") If Vbl IsNot Nothing Then Dim wz As long = Tables("职务变动基础信息").FindRow(dr) If wz >= 0 Then Tables("职务变动基础信息").Position = wz End If End If Forms("职务变动人员基础信息录入").Open() End If MessageBox.Show("在职务变动基础数据表中没有查询到该姓名的人员,我们将在调资基础数据表中查询读入该人员的基础信息!!!", "提示", MessageBoxButtons.OK,MessageBoxIcon.Information) End With dim f1 As New Filler f1.SourceTable = DataTables("调资基础数据") '指定数据来源 f1.SourceCols = "序号,单位名称,姓名,身份证号,性别,出生时间,参加工作时间,职务" '指定数据来源列 f1.DataTable = DataTables("职务变动基础信息") '指定数据接收表 f1.DataCols = "序号,单位名称,姓名,身份证号,性别,出生时间,参加工作时间,变动前职务" '指定数据接收列 f1.ExcludeExistValue = "true" f1.ExcludeNullValue = "true" With e.Form.Controls("单位名称") If .Value IsNot Nothing Then f1.Filter= "[身份证号]= '" & .Value & "'" End If End With f1.Fill() '填充数据 MessageBox.Show("你录入的职务变动人员,其基础信息已从调资基础数据表读入到职务变动基础信息表!!!", "提示") If Vbl IsNot Nothing Then Dim wz As long = Tables("职务变动基础信息").FindRow(dr) If wz >= 0 Then Tables("职务变动基础信息").Position = wz End If End If Forms("职务变动人员基础信息录入").Open() End If
|