同时查询时间型和字符型
这是我调试后的结果:帐号='1111111111111111111'or 帐号='1111111111111111112'or 帐号='1234567891234567891'or 帐号='1111111111111111111'and 交易时间=2008-2-2
就是说对上面这语句进行setfilter()后报错,expression is not valid
问题是:我对数值型和字符型一起查找时,是可以的.如上面把and 交易时间=2008-2-2替成数量等于20.
我的目的是这样的,要把dw_3的窗口已经查询好的条件做为基础,然后再加个查询.并显示在dw_3上.
注:我已经用过SQL的方法了,只是老报where附近出错.所以我就放弃了,用这种方法试试.
下面是我目前的代码:______________________________________________________________________
if sle_2.text="" then
messagebox("注意!","请输入查找开始月份!")
else
//定义参数:查条件综合结果
string LookforCondition2,lookforcondition1,lookforcondition3,lookfrocondition4
//定义参数:要查询的列
string LookforItem,lookforhow1,lookforhow2
//定义参数:要查询的内容
string LookforWhat2,lookforwhat1
//定义参数:总的行数
int total_row
string all_col[]
string lookforallitem1,lookforallitem2
int i
total_row=dw_3.rowcount()
if total_row=0 then
messagebox("注意","已经没有可查询数据!")
else
for i=1 to total_row
all_col[i]=dw_3.getitemstring(i,1)
next
lookforallitem2="编号"+"="+"'"+all_col[1]+"'"
i=2
do while i <=total_row
lookforallitem1="编号"+"="+"'"+string(all_col[i])+"'"
lookforallitem2=lookforallitem2+"or"+" "+lookforallitem1
i=i+1
loop
//查询子段和查询内容的选择
lookforcondition3="月份"+">="+""+string(lookforwhat1)+""
lookfrocondition4="月份"+" <="+""+string(lookforwhat2)+""
lookforcondition1=lookfrocondition4+"and"+" "+lookforcondition3
lookforCondition2=lookforallitem2+"and"+" "+lookforcondition1
//定义读者编号
//过滤数据窗口dw_1
dw_3.setfilter(lookforCondition2)
filter(dw_3)