E
empty023
Unregistered / Unconfirmed
GUEST, unregistred user!
我現在要通過點擊button查詢出位於DateTimePicker1和DateTimePicker2之間的所有數據.
我用adoquery這樣寫:
adoquery1.Close;
adoquery1.sql.clear;
adoquery1.SQL.Add('select * from ddr where time between :jcrq1 and :jcrq2');
adoquery1.Parameters.ParamByName('jcrq1').Value:=strtodatetime(datetimetostr(DateTimePicker1.Date));
adoquery1.Parameters.ParamByName('jcrq2').Value:=strtodatetime(datetimetostr(DateTimePicker2.Date));
adoquery1.Open;
程序ok沒問題,可以查出想要的,但我現在要用dbexpress的SimpleDataSet1控件,而SimpleDataSet1沒有Parameters函數...也就不能按照ado的寫,我試則這樣寫:
SimpleDataSet1.Active:=false;
SimpleDataSet1.DataSet.CommandText:='select * from ddr where time between '''+(strtodate(datetostr(DateTimePicker1.Date))+''' and '''+strtodate(datetostr(DateTimePicker2.Date))+''' ';
可是不行 請問在dbexpress下該怎麼寫?我用的是oracle數據庫.
我用adoquery這樣寫:
adoquery1.Close;
adoquery1.sql.clear;
adoquery1.SQL.Add('select * from ddr where time between :jcrq1 and :jcrq2');
adoquery1.Parameters.ParamByName('jcrq1').Value:=strtodatetime(datetimetostr(DateTimePicker1.Date));
adoquery1.Parameters.ParamByName('jcrq2').Value:=strtodatetime(datetimetostr(DateTimePicker2.Date));
adoquery1.Open;
程序ok沒問題,可以查出想要的,但我現在要用dbexpress的SimpleDataSet1控件,而SimpleDataSet1沒有Parameters函數...也就不能按照ado的寫,我試則這樣寫:
SimpleDataSet1.Active:=false;
SimpleDataSet1.DataSet.CommandText:='select * from ddr where time between '''+(strtodate(datetostr(DateTimePicker1.Date))+''' and '''+strtodate(datetostr(DateTimePicker2.Date))+''' ';
可是不行 請問在dbexpress下該怎麼寫?我用的是oracle數據庫.