Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
为什么下面代码不能进行匹配加载数据,
Dim txb2 As WinForm.TextBox = e.form.Controls("TxtB2")
With dataTables("炉次")
.loadFilter ="[炉次编号] like '*" & txb2.value & "*'"
.load()
End With
txb2必需输入完整的字符后才能加载。
Dim txb2 As WinForm.TextBox = e.form.Controls("TxtB2")
With dataTables("炉次")
.loadFilter ="[炉次编号] like 'ASBC123'"
.load()
End With
LIKE运算符
LIKE运算符用于将指定表达式的值和一个模式字符串进行比较,判断两者是否匹配。
你在LIKE 操作样式里可以使用多种通配符,如下所示:
%(百分号)
匹配任意个数的字符。
[](方括号)
匹配任何被包括在方括号里面的单个字符。
!(感叹号)
匹配任何不属于被方括号所包含的字符。
-(连字符)
用于指定一个字符范围。
例如:
Like 'C%',
表示以字符C开始的值。
Like 'P[A-F]%'
表示以字母P开头、而其后接着介于A到F之间的任何一个字母,最后是任意个数的任何字符。
找出客户表中的贸易公司:
SELECT * FROM {客户} WHERE 公司名称 LIKE '%贸易%'
找出客户ID不是以字母A或B字母的客户:
SELECT * FROM {客户} WHERE 客户ID LIKE '[!AB]%'
找出客户ID以字母A、B、C、D中任何一个开头的客户:
SELECT * FROM {客户} WHERE 客户ID LIKE '[A-D]%'
可以利用NOT关键词进行反向操作,例如:
SELECT * FROM {客户} WHERE 公司名称 NOT LIKE '%贸易%'
找出所有非贸易公司。
为什么开始日期和结束日期只输入一个时会报错,代码哪块有问题?
Dim tpk1 As WinForm.DateTimePicker = e.form.Controls("datetimepicker1")
Dim tpk2 As WinForm.DateTimePicker = e.form.Controls("datetimepicker2")
if tpk2.text is nothing and tpk1.text isnot nothing then
With dataTables("炉次")
.loadFilter = "[日期] =#" & tpk1.text & "#"
.load()
End With
end if
if tpk1.text isnot nothing and tpk2.text isnot nothing then
With dataTables("炉次")
.loadFilter = "[日期] >=#" & tpk1.text & "# and [日期] <=#" & tpk2.text & "#"
.load()
End With
end if
学习
这段代码是模糊筛选的
CurrentTable.Filter = ""
Dim Filter As String
With e.Form.Controls("ListBox1")
If .Value IsNot Nothing Then
Filter = "'*" & .Value & "*'"
End If
End With
If Filter > "" Then
Tables("常用代码").Filter = "cz Like " & Filter & " Or dm Like " & Filter & " Or sm Like " & Filter & " Or lx Like " & Filter & " Or dmwz Like " & Filter
我想问一下改成模糊加载应该怎么改?
这段代码是模糊筛选的
CurrentTable.Filter = ""
Dim Filter As String
With e.Form.Controls("ListBox1")
If .Value IsNot Nothing Then
Filter = "'*" & .Value & "*'"
End If
End With
If Filter > "" Then
Tables("常用代码").Filter = "cz Like " & Filter & " Or dm Like " & Filter & " Or sm Like " & Filter & " Or lx Like " & Filter & " Or dmwz Like " & Filter
我想问一下改成模糊加载应该怎么改?
这样试下
CurrentTable.Filter = ""
Dim Filter As String
With e.Form.Controls("ListBox1")
If .Value IsNot Nothing Then
Filter = "'%" & .text & "%'"
End If
End With
If Filter > "" Then
Tables("常用代码").Filter = "cz Like " & Filter & " Or dm Like " & Filter & " Or sm Like " & Filter & " Or lx Like " & Filter & " Or dmwz Like " & Filter
这样试下
CurrentTable.Filter = ""
Dim Filter As String
With e.Form.Controls("ListBox1")
If .Value IsNot Nothing Then
Filter = "'%" & .text & "%'"
End If
End With
If Filter > "" Then
Tables("常用代码").Filter = "cz Like " & Filter & " Or dm Like " & Filter & " Or sm Like " & Filter & " Or lx Like " & Filter & " Or dmwz Like " & Filter
我要模糊加载。"loadfilter"
这个我试过的,不行!