Dim Filter As String
Dim cls() as String = ("列1","列2","列3")
Dim ops() AS string = ("=" ,"=",">")
dim nms() as string = {"TextBox1","TextBox2","TextBox3"}
for i as integer = 0 to nms.length -1
if e.form.Controls(nm).Value is not nothing then
if filter > "" then
filtter = filter & " And "
end if
dim prefix as string = ""
if datatables("表名").DataCols(cls(i)).Isdate then
prefix = "#"
elsieif datatables("表名").DataCols(cls(i)).IsString then
prefix = “‘”
end if
filter = filter & cls(i) & ops(i) & prefix & e.form.Controls(nm).Value & prefix
end if
next
。。。。