以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  求助:有没有办法将查询到的两行记录,自动转为两行文本呢?  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=130985)

--  作者:李孝春
--  发布时间:2019/2/13 16:57:00
--  求助:有没有办法将查询到的两行记录,自动转为两行文本呢?

图片点击可在新窗口打开查看此主题相关图片如下:11.png
图片点击可在新窗口打开查看

输入盗窃能够模糊查询到两条信息
代码如下
Dim txt As String = e.Form.Controls("TextBox1").Text
Dim tbl As Table = Tables("法律法规")
If txt = "" Then
    tbl.Filter = ""
Else
    Dim filter As String = "1=1"
    For Each s As String In txt.Split(" ")
        Filter &= " and 罪名 Like \'%" & s & "%\' and 具体内容 Like \'%" & s & "%\'"        
    Next
    tbl.filter = filter
End If

有没有办法将查询到的两行记录,自动转为两行文本呢?





 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目2.table





图片点击可在新窗口打开查看此主题相关图片如下:11.png
图片点击可在新窗口打开查看
下图代码实现当前行数据组合实现,有没有办法实现多行数据实现呢?每行数据间用;号区隔开
代码如下Dim txt As String = e.Form.Controls("TextBox1").Text
Dim tbl As Table = Tables("法律法规")
If txt = "" Then
    tbl.Filter = ""
Else
    Dim filter As String = "1=1"
    For Each s As String In txt.Split(" ")
        Filter &= " and 罪名 Like \'%" & s & "%\' and 具体内容 Like \'%" & s & "%\'"        
    Next
    tbl.filter = filter
End If
Dim txt1 As WinForm.TextBox = e.Form.Controls("TextBox2")
Dim ab As Row=Tables("法律法规").Current
txt1.Text= ab("罪名") &  ab("具体内容") & ab("法条")& ab("款项")& ab("法律名")& ab("发布时间")

[此贴子已经被作者于2019/2/13 17:25:44编辑过]

--  作者:2900819580
--  发布时间:2019/2/13 17:28:00
--  
Dim filter As String = "1=1" 为什么要这样做?
    For Each s As String In txt.Split(" ")
        Filter &= " and 罪名 Like \'%" & s & "%\' and 具体内容 Like \'%" & s & "%\'"        
    Next

更改为 If txt > "" Then  tbl.filter = "罪名 Like \'%" & txt.text & "%\' and 具体内容 Like \'%" & txt.text & "%\'"       能否实现你的筛选
筛选后,
Dim txt1 As WinForm.TextBox = e.Form.Controls("TextBox2")
for each ab as row in tbl.rows
if txt1.Text  > "" then txt1.Text &= ";"
txt1.Text &= ab("罪名") &  ab("具体内容") & ab("法条")& ab("款项")& ab("法律名")& ab("发布时间")
next

试试!
[此贴子已经被作者于2019/2/13 17:28:16编辑过]

--  作者:有点甜
--  发布时间:2019/2/13 17:47:00
--  
Dim txt As String = e.Form.Controls("TextBox1").Text
Dim tbl As Table = Tables("法律法规")
If txt = "" Then
    tbl.Filter = ""
Else
    Dim filter As String = "1=1"
    For Each s As String In txt.Split(" ")
        Filter &= " and 罪名 Like \'%" & s & "%\' and 具体内容 Like \'%" & s & "%\'"
    Next
    tbl.filter = filter
End If
Dim txt1 As WinForm.TextBox = e.Form.Controls("TextBox2")
Dim ss As String = ""
For Each ab As Row In tbl.rows
    If ss  > "" Then ss &= ";"
    ss &= ab("罪名") &  ab("具体内容") & ab("法条")& ab("款项")& ab("法律名")& ab("发布时间")
Next
txt1.Text  = ss

--  作者:李孝春
--  发布时间:2019/2/13 17:47:00
--  回复:(2900819580)Dim filter As String = "1=1" 为...
不得行  会将所有记录重复两次
--  作者:李孝春
--  发布时间:2019/2/13 17:48:00
--  回复:(有点甜)Dim txt As String = e.Form.Control...
谢谢有点甜老师


如果是表a中罪名字段值=盗窃时,怎么修改为去自动筛选法律法规的对于盗窃模糊值查询,并输出呢?
[此贴子已经被作者于2019/2/13 17:59:04编辑过]

--  作者:有点甜
--  发布时间:2019/2/13 18:08:00
--  
以下是引用李孝春在2019/2/13 17:48:00的发言:
谢谢有点甜老师


如果是表a中罪名字段值=盗窃时,怎么修改为去自动筛选法律法规的对于盗窃模糊值查询,并输出呢?
[此贴子已经被作者于2019/2/13 17:59:04编辑过]

 

Dim txt As String = "盗窃"
Dim tbl As DataTable = DataTables("法律法规")

Dim filter As String = "1=1"
For Each s As String In txt.Split(" ")
    Filter &= " and 罪名 Like \'%" & s & "%\' and 具体内容 Like \'%" & s & "%\'"
Next

Dim ss As String = ""
For Each ab As DataRow In tbl.Select(filter)
    If ss  > "" Then ss &= ";"
    ss &= ab("罪名") &  ab("具体内容") & ab("法条")& ab("款项")& ab("法律名")& ab("发布时间")
Next
msgbox(ss )