以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]人工数据填充代码,运行没反应,请专家看看,谢谢 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=194215) |
|
-- 作者:hrw68529 -- 发布时间:2024/11/20 9:06:00 -- [求助]人工数据填充代码,运行没反应,请专家看看,谢谢 是不是标红的地方有问题,我的思路是:符合责任单位和区分两项的,才能进行填充。当我把“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 |
|
-- 作者:cd_tdh -- 发布时间:2024/11/20 9:13:00 -- 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编辑过]
|
|
-- 作者:有点蓝 -- 发布时间:2024/11/20 9:13:00 -- 如果是模糊查询使用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 [区分] = \'加减分\'")
|
|
-- 作者:hrw68529 -- 发布时间:2024/11/20 9:15:00 -- 有点蓝老师,想用模糊查询,上边语句运行没反应,怎么改。谢谢 |
|
-- 作者:y2287958 -- 发布时间:2024/11/20 9:28:00 -- 将“%”改为“*”试试 |
|
-- 作者:hrw68529 -- 发布时间:2024/11/20 9:30:00 -- 好了,谢谢了 |
|
-- 作者:cd_tdh -- 发布时间:2024/11/20 10:13:00 -- 建议代码还是要写严禁,向帮助这样,该判断的空值不能少。 |