是不是标红的地方有问题,我的思路是:符合责任单位和区分两项的,才能进行填充。当我把“and”换成“or”,只填充“加减分”内容,不填写“责任单位”的内容。谢谢
Dim Cols1() As String = {"总序号","序号","六项行动","分项内容","考评项目"}
Dim Cols2() As String = {"总序号","序号","六项行动","分项内容","考评项目"}
For Each dr1 As DataRow In DataTables("六大行动模板").Select("[责任单位] = '%" & e.form.controls("市局单位").Text & "%' and [区分] = '加减分'")
'For Each dr1 As DataRow In DataTables("六大行动模板").Select("区分 like '%" & e.form.controls("区分").Text & "%'or [责任单位] = '%" & e.form.controls("市局单位").Text & "%' And [区分] ='加减分'")
Dim dr2 As DataRow = Tables("六大行动_汇报").DataTable.AddNew()
For i As Integer = 0 To Cols1.Length -1
dr2(Cols2(i)) = dr1(Cols1(i))
Next
Next
http://www.foxtable.com/webhelp/topics/1451.htm
For Each dr1 As DataRow In DataTables("六大行动模板").Select("[责任单位] like '%" & e.form.controls("市局单位").Text & "%' and [区分] = '加减分'")
[此贴子已经被作者于2024/11/20 9:14:35编辑过]
如果是模糊查询使用like
For Each dr1 As DataRow In DataTables("六大行动模板").Select("[责任单位] like '%" & e.form.controls("市局单位").Text & "%' and [区分] = '加减分'")
如果要精确查询,去掉%
For Each dr1 As DataRow In DataTables("六大行动模板").Select("[责任单位] = '" & e.form.controls("市局单位").Text & "' and [区分] = '加减分'")
有点蓝老师,想用模糊查询,上边语句运行没反应,怎么改。谢谢