Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共7 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[求助]人工数据填充代码,运行没反应,请专家看看,谢谢

1楼
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

2楼
cd_tdh 发表于:2024/11/20 9:13:00
http://www.foxtable.com/webhelp/topics/1451.htm

http://www.foxtable.com/webhelp/topics/0688.htm

For Each dr1 As DataRow In DataTables("六大行动模板").Select("[责任单位] like '%" & e.form.controls("市局单位").Text & "%' and [区分] = '加减分'")
[此贴子已经被作者于2024/11/20 9:14:35编辑过]
3楼
有点蓝 发表于: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 [区分] = '加减分'")
4楼
hrw68529 发表于:2024/11/20 9:15:00
有点蓝老师,想用模糊查询,上边语句运行没反应,怎么改。谢谢
5楼
y2287958 发表于:2024/11/20 9:28:00
将“%”改为“*”试试
6楼
hrw68529 发表于:2024/11/20 9:30:00
好了,谢谢了

7楼
cd_tdh 发表于:2024/11/20 10:13:00
建议代码还是要写严禁,向帮助这样,该判断的空值不能少。


共7 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02148 s, 2 queries.