原来没有问题,后来又加了一个query2,是在原的query1的基础上进行count操作
现在一运行就出错,错误信息为:
ct_cursor(close):user api layer:external error: a cursor must be opened before this command type can be initialized
现在一运行就出错,错误信息为:
ct_cursor(close):user api layer:external error: a cursor must be opened before this command type can be initialized
procedure TQueryForm.QueryRed;
begin
query1.close;
Query1.sql.Clear;
Query1.sql.Add('select * from cc_record where opdate>=:starDate and opdate<=:endDate');
Query1.ParamByName('starDate').AsDateTime:=DateTimePicker1.Date;
Query1.ParamByName('endDate').AsDateTime:=DateTimePicker2.Date;
query1.Prepare;
Query1.open; query2.close;
Query2.sql.Clear;
Query2.sql.Add('select count(*) from cc_record where opdate>=:starDate and opdate<=:endDate');
Query2.ParamByName('starDate').AsDateTime:=DateTimePicker1.Date;
Query2.ParamByName('endDate').AsDateTime:=DateTimePicker2.Date;
query2.Prepare;
Query2.open;