在ADO中对数据表进行过滤 adotable1.filter:='saledate>=#2002-05-08#'为何不行?(10分)

  • 主题发起人 主题发起人 lindeping
  • 开始时间 开始时间
L

lindeping

Unregistered / Unconfirmed
GUEST, unregistred user!
在ADO中对数据表进行过滤
adotable.connection:=adoconnection1;
adotable.tablename:='sales.dbf';
adotable.filter:='saledate>=#2002-05-08#'
adotable.filter:=true;
adotable.open;
为何不行?
而用 adotable.filter:='saledate=#2002-05-08#'却没有问题,
使用ADOQUERY进行
adoquery.close;
adoquery.connection:=adoconnection1;
adoquery.sql.txt:='select * from sales.dbf where saledate>=#2002-05-08#';
adoquery.open;
没有问题.
 
过滤条件不支持那个,没有办法的,就象过滤条件中不可以写filter:='*abc*'一样
日期类型的,不要用过滤条件,没有办法的

 
adotable.filter='saledate>=''2002-05-08'''
 
好象adotable只能过滤 '* = *'一类,而对于含有 '>','<'之类比较操作符,就不行了
(比如,我在 filter 中写入“adotable.filter:='price>25.5'”就报错,price是数字型
字段,错误信息如下:“Project sumPrj.exe raised exception class EOLeException with
message 'Arguments are of the wrong type,are out of acceptable range,or are in
conflict with one another'.Process stopped.Use Step or Run to continue.”)为何。
如果用ADOQUERY执行同样功能的SQL语句是没有问题的,不过在此adoquery中进行编辑修改记录
会不会想adtable中一样好用呢?
 
hpretty老兄的方法不行,编译通不过,报错信息如下:
Project sumPrj.exe raised exception class EOLeException with
message 'Item cannot be found in the collection corresponding to
the requested name or ordinal'.Process stopped.Use
Step or Run to continue.
在加一句:我用adotable操作的是DBF数据库(dBase)
adotable.filter中到底能写入那些语句?
 
用adotable.filter:='saledate>=strtodate(''2002-05-08'')'不就行啦
没试过,我几乎从不用adotable,对这类问题我推荐都用sql
adodataset or adoquery
其中采用adodataset1.commandtext:='select * from 表 where saledate>=strtodate(''2002-05-08'')'肯定是ok
 
后退
顶部