誰知道這個針對Access的SQL怎麼寫(150分)

S

shiny

Unregistered / Unconfirmed
GUEST, unregistred user!
用的是BDE+ACCESS2000
數據控件為 TQuery,SQL.Add('select * from t1 where rq=#2000/1/1#')
當RequestLive = false時,以上能打開數據
當RequestLive = True時,以上不能打開數據,顯示錯誤如下
Invalid use of keyword.
Token:rq=
Line number:1.
 
SQL.Add('select * from t1 where rq=#2000-01-01#')
 
RQ 是关键字,改成其它字段名试试!
 
NO,NO!!沒有建設性
 
Set RequestLive to specify whether or not the BDE should attempt to return a live result set to the application. RequestLive is False by default, meaning that a query always returns a read-only result set.

Set RequestLive to True to request a live result set. Setting RequestLive to True does not guarantee that a live result set is returned by the BDE. The BDE returns a live result set only if the SELECT syntax of the query conforms to the syntax requirements for a live result set.

If RequestLive is True, but the syntax does not conform to the requirements, the BDE returns a read-only result set for Paradox or dBASE, or an error return code for remote servers.
因为Access是桌面数据库;好好看看帮助 ok?
 
to shiny:
主要是dbe的游标处理由问题!如果where是其他数据类型是可以打开,但修改后同样会出现问题
 
adoquery1.Close ;
adoquery1.SQL.Clear ;
adoquery1.SQL.Add('select * from tab1');
adoquery1.SQL.Add('where rq=:d1');
adoquery1.Parameters.Clear;
adoquery1.Parameters.Add;
adoquery1.Parameters[0].DataType:=ftdate;
adoquery1.Parameters[0].Value:='2001-1-1';
应该是可以的吧,我以前试过!
 
//數據控件為 TQuery,SQL.Add('select * from t1 where rq=#2000/1/1#')
这个语句没有错,设RequestLive = True干么,想编辑它吗?
 
to mikeZ:其他類型做where的確打開沒有這類問題,那麼在修改的時候會怎麼樣?
to loxtln:出現錯誤,信西為"無效的datetime格式(null)",正確的格式是甚麼
to smallbs:是別人程序的爛攤子不過我不想大修改,換我也不會這麼搞,當然用ado兼容好
很多,就算用TQuery+BDE也應該用UpdateObject的方式.這我懂的
 
奇怪!!我在WIN98 DELPHI6 下通过的呀!!
你的RQ 字段是短日期格式吗?
 
顶部