'''
'================================================
'多列查询
'在主表中,按选定的字段及给定的关键字查询!
'
'================================================
Dim lsb As String= Args(0) '查询条件(要查询的字段)
Dim txt As String= Args(1) '查询的关键词
Dim pd As Integer=args(2) '匹配位置
Dim sql As String
If txt="" Then
sql =""
ElseIf txt > "" Then
Select Case pd
Case 0 '任意位置匹配
txt = "'%" & txt & "%'"
Case 1 '开始位置匹配
txt = "'" & txt & "%'"
Case 2 '结束位置匹配
txt = "'%" & txt & "'"
Case 3 '完全匹配
txt = "'" & txt & "'"
End Select
' txt = "'%" & txt & "%'"
If lsb="" Then '如果没选定列,按所有string类型列查询
For Each dc As DataCol In DataTables(MainTable.DataTable.Name).DataCols
If dc.IsString Then
'sql=sql & dc.name & " Like " & txt & " or "
Select Case pd
Case 0,1,2 '任意位置匹配
sql=sql & dc.name & " Like " & txt & " or "
Case 3 '完全匹配
sql=sql & dc.name & " = " & txt & " or "
End Select
End If
Next
ElseIf lsb > "" Then '否则按选定列查询
Dim Values() As String
Values = lsb.split(",")
For Each lstr As String In values
' sql=sql & lstr & " Like " & txt & " or "
Select Case pd
Case 0,1,2 '任意位置匹配
sql=sql & lstr & " Like " & txt & " or "
Case 3 '完全匹配
sql=sql & lstr & " = " & txt & " or "
End Select
Next
End If
sql=sql.Trim(" ","r","o")
End If
Functions.Execute("动态加载",MainTable.name,sql)
lsb=""
txt=""
'''
'============================================================
'
'动态加载
'
'============================================================
Dim tbName As String= Args(0)
Dim sql As String= Args(1)
If sql = "" Then '查询条件为空时
If MessageBox.Show("查询条件为空时,默认加载所有信息!" & vbcrlf & "你确定吗?","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Warning)=DialogResult.Yes Then
Else
Exit Function
End If
End If
With DataTables(tbName)
.LoadFilter=sql
'.LoadTop =20
'.LoadPage = 0
.Load()
End With
Return DataTables(tbName).DataRows.Count
这样的吗?系统本身带的有啊,再加一个日期控件改造一下,和狐爸给的帮助的差不多的