以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 查询的一个问题? (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=55589) |
||||
-- 作者:jk362223 -- 发布时间:2014/8/19 17:16:00 -- 查询的一个问题? 示例,窗口2,按钮代码是 Dim cmd As New SQLCommand cmd.C Dim Filter As StringDim cmd As New SQLCommand cmd.C With e.Form.Controls("ComboBox2") If .Value IsNot Nothing Then Filter = "标识 = \'" & .Value & "\'" End If End With With e.Form.Controls("ComboBox1") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "姓名 = \'" & .Value & "\'" End If End With If e.Form.Controls("CheckBox2").Checked = True \' 如果付款状态选择了"已付" If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "已申请 = True" End If If e.Form.Controls("CheckBox3").Checked = True \' 如果付款状态选择了"未付" If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "已申请 = False Or 已申请 Is Null" End If DataTables("实验室检查").LoadFilter = filter DataTables("实验室检查").Load "sql201407"是外部数据源, 出现提示
若是内部表,则上述代码可以用,转为外部表,则出现上述提示 |
||||
-- 作者:有点甜 -- 发布时间:2014/8/19 17:18:00 -- 报什么错? |
||||
-- 作者:jk362223 -- 发布时间:2014/8/19 17:21:00 -- 说是列名“true”无效 |
||||
-- 作者:有点甜 -- 发布时间:2014/8/19 17:22:00 -- true 改成 1
false 改成 0 |
||||
-- 作者:jk362223 -- 发布时间:2014/8/19 17:24:00 -- 选择“全部”可以,选择“已申请”和“未申请”,则提示列名“true”无效 |
||||
-- 作者:有点甜 -- 发布时间:2014/8/19 17:27:00 -- true 改成 1
false 改成 0 |
||||
-- 作者:jk362223 -- 发布时间:2014/8/19 17:34:00 -- Dim Filter As String With e.Form.Controls("ComboBox2") If .Value IsNot Nothing Then Filter = "标识 = \'" & .Value & "\'" End If End With With e.Form.Controls("ComboBox1") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "姓名 = \'" & .Value & "\'" End If End With If e.Form.Controls("CheckBox2").Checked = 1 \' 如果付款状态选择了"已付" If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "已申请 = 1" End If If e.Form.Controls("CheckBox3").Checked = 1 \' 如果付款状态选择了"未付" If Filter >"" Then Filter = Filter & " And " End If Filter = Filter & "已申请 = 0 Or 已申请 Is Null" End If DataTables("实验室检查").LoadFilter = filter DataTables("实验室检查").Load 是不是这样改? |
||||
-- 作者:有点甜 -- 发布时间:2014/8/19 17:35:00 -- Dim Filter As String
With e.Form.Controls("ComboBox2")
If .Value IsNot Nothing Then
Filter = "标识 = \'" & .Value & "\'"
End If
End With
With e.Form.Controls("ComboBox1")
If .Value IsNot Nothing Then
If Filter > "" Then
Filter = Filter & " And "
End If
Filter = Filter & "姓名 = \'" & .Value & "\'"
End If
End With
If e.Form.Controls("CheckBox2").Checked \' 如果付款状态选择了"已付"
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "已申请 = 1"
End If
If e.Form.Controls("CheckBox3").Checked \' 如果付款状态选择了"未付"
If Filter >"" Then
Filter = Filter & " And "
End If
Filter = Filter & "已申请 = 0 Or 已申请 Is Null"
End If
DataTables("实验室检查").LoadFilter = filter
DataTables("实验室检查").Load
|