以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  按钮代码问题求助?  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=63942)

--  作者:lisheng7177
--  发布时间:2015/2/1 19:51:00
--  按钮代码问题求助?

Dim Result As DialogResult
Result = MessageBox.Show("确定导出?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question,MessageBoxDefaultButton.Button2)
Dim Cols1() As String = {"工作单位","县公司","姓名","性别","身份证号码","文化程度","鉴定等级","申报鉴定工种","鉴定批次","申报性质","备注","照片","是否合格","理论考否","考试性质"}
Dim Cols2() As String = {"工作单位","县公司","姓名","性别","身份证号码","文化程度","鉴定等级","申报鉴定工种","鉴定批次","申报性质","备注","照片","是否合格","理论考否","考试性质"}
For Each dr1 As DataRow In DataTables("审核合格表").Select("[理论考否] = True ")
    Dim dr2 As DataRow = DataTables("理论机考表").Find("身份证号码 = \'" & dr1("身份证号码") & "\'")
    If dr2 Is Nothing Then
        dr2 = DataTables("理论机考表").AddNew
    End If
    For i As Integer = 0 To Cols1.Length -1
        dr2(Cols2(i)) = dr1(Cols1(i))
    Next
Next

 

这段代码中为什么我把For Each dr1 As DataRow In DataTables("审核合格表").Select("[理论考否] = True ")

改成 For Each dr1 As DataRow In DataTables("审核合格表").Select("[考试性质] = 纸质考试 ")就提示找不到列?

 

因为考试性质中有:上机考试、纸质考试、补考实操......等,我要根据对考试性质的筛选分别将考生导向不同中的表,那我应该怎么写代码?请版主指教!


--  作者:黄训良
--  发布时间:2015/2/1 21:44:00
--  
For Each dr1 As DataRow In DataTables("审核合格表").Select("[考试性质] = \'纸质考试\'")
--  作者:lisheng7177
--  发布时间:2015/2/1 23:04:00
--  
谢谢!原来是单引号惹得事!
--  作者:Bin
--  发布时间:2015/2/2 8:34:00
--  
新手要特别注意表达式的拼接