Foxtable(狐表)用户栏目专家坐堂 → 查询数据


  共有3057人关注过本帖树形打印复制链接

主题:查询数据

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/10/10 17:57:00 [显示全部帖子]

Dim ts() As String = {"表A", "表B", "表C"}
For Each t As String In ts
    Dim fdr As DataRow = DataTables(t).Find("")
    If fdr IsNot Nothing Then
       
    End If
Next


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/10/11 15:33:00 [显示全部帖子]

Dim ts() As String = {"表A", "表B", "表C"}
For Each t As String In ts
    Dim dt As DataTable = DataTables(t)
    For Each dc As DataCol In dt.datacols
        Dim fdr As DataRow = dt.Find("convert(" & dc.name & ",'System.String') = '" & 123 & "'")
        If fdr IsNot Nothing Then
            msgbox(3)
        End If
    Next
Next

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/10/11 21:14:00 [显示全部帖子]

多表、多列,尽量不要用sqlFind,不然多次使用sqlFind,效率很慢的。

 

Dim ts() As String = {"表A", "表B", "表C"}
For Each t As String In ts
    Dim dt As DataTable = DataTables(t)
    For Each dc As DataCol In dt.datacols
        If dc.IsString Then
            Dim fdr As DataRow = dt.sqlFind(dc.name & " = '" & 123 & "'")
            If fdr IsNot Nothing Then
                msgbox(3)
            End If
        End If
    Next
Next


 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/10/13 10:33:00 [显示全部帖子]

Dim ts() As String = {"表A", "表B", "表C"}
For Each t As String In ts
    Dim dt As DataTable = DataTables(t)
    Dim idxs As String = "-1,"
    For Each dc As DataCol In dt.datacols
        If dc.IsString Then
            Dim fdr As DataRow = dt.sqlFind(dc.name & " = '" & 123 & "'")
            If fdr IsNot Nothing Then
                idxs = idxs & fdr("_Identify") & ","
                Exit For
            End If
        End If
    Next
    dt.LoadFilter = "[_Identify] in (" & idxs.trim(",") & ")"
    dt.load
Next

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/12/14 17:06:00 [显示全部帖子]

Dim ts() As String = {"表A", "表B", "表C"}
For Each t As String In ts
    Dim dt As DataTable = DataTables(t)
    Dim idxs As String = "-1,"
    For Each dc As DataCol In dt.datacols
        If dc.IsString Then
            For Each fdr As DataRow In dt.sqlselect(dc.name & " = '" & 123 & "'")
                idxs = idxs & fdr("_Identify") & ","
            Next
        End If
    Next
    dt.LoadFilter = "[_Identify] in (" & idxs.trim(",") & ")"
    dt.load
Next

 回到顶部