是不是第一次查询后第二次查询之前没有交Query关掉?
Query.close;
Query.aql.add('');
Query.open;
Query.close;
Query.aql.add('');
Query.open;
解决方案 »
- 出售高速公路方面的两个系统。源代码出售。包含GIS
- DBGridEh的问题,帮帮我吧
- 初学者请教高手。。。。。。。。。谢谢谢
- 再次散分~~~~~~~~~~~~~~~~~~~~
- http://www.truedelphi.com
- 询问DELPHI中的一个函数。
- delphi如何调用vc写的含有窗体的dll
- TAdoQuery的大BUG?断网重连后不能再Open公用AdoQuery,否则堆栈溢出。
- 怎么样读取文本文件中东西(68分。。继续加)
- delphi用show方法打开窗体出错
- !!! 高手指点,在线等待,帮帮我啊,谢谢!!!
- 用Variant操作Excel时,如何才能读出Excel中的一个给定格子的数据并其放入string变量里?
var
SQLStr,SQLAll,Log:String;
SQLTemp:Pchar;
arrstr:array[1..13]of String;
i,l:integer;
function getsth(CurrEdit:TEdit):boolean;
begin
result:=false;
if CurrEdit.Text<>'' then
result:=true;
end;
begin
SQLAll:='';
SQLStr:='SELECT * FROM "YQBaseInfo" WHERE ';
if RadioGroup1.ItemIndex=1 then Log:='OR' else Log:='AND';
arrstr[1]:=Cob_bianhao.Text;
if arrstr[1]<>'' then
arrstr[1]:='(设备编号='''+arrstr[1]+''')';
arrstr[2]:=Cob_status.text;
if arrstr[2]<>'' then
arrstr[2]:='(现状='''+arrstr[2]+''')';
arrstr[3]:=Cob_xinghao.text;
if arrstr[3]<>'' then
arrstr[3]:='(型号='''+arrstr[3]+''')';
arrstr[4]:=Cob_gzrq.text;
if arrstr[4]<>'' then
arrstr[4]:='(购置日期='''+arrstr[4]+''')';
arrstr[5]:=Cob_fzwz.text;
if arrstr[5]<>'' then
arrstr[5]:='(放置位置='''+arrstr[5]+''')';
arrstr[6]:=Cob_chandi.Text;
if arrstr[6]<>'' then
arrstr[6]:='(产地='''+arrstr[6]+''')';
arrstr[7]:=Cob_flh.text;
if arrstr[7]<>'' then
arrstr[7]:='(分类号='''+arrstr[7]+''')';
arrstr[8]:=Cob_plant.text;
if arrstr[8]<>'' then
arrstr[8]:='(生产厂家='''+arrstr[8]+''')';
arrstr[9]:=Cob_glry.text;
if arrstr[9]<>'' then
arrstr[9]:='(管理人员='''+arrstr[9]+''')';
arrstr[10]:=Cob_name.text;
if arrstr[10]<>'' then
arrstr[10]:='(设备名称='''+arrstr[10]+''')';
if arrstr[11]<>'' then
arrstr[11]:='(维修次数='''+Edit_cishu.Text+''')';
if arrstr[12]<>'' then
arrstr[12]:='(附件总数='''+Edit_total.Text+''')';
arrstr[13]:='';
for i:=1 to 12 do
begin
arrstr[13]:=arrstr[13]+arrstr[i];
if arrstr[i]<>'' then
SQLAll:=SQLAll+Log+arrstr[i];
end;
if arrstr[13]='' then
begin
showmessage('没有输入查询条件!请输入具体的查询条件。');
exit;
end; l:=strlen(Pchar(SQLAll));
GetMem(SQLTemp,l);
SQLTemp^ := Chr(0); if SQLAll[1]='O' then
StrCat(SQLTemp,Pchar(SQLAll)+2);
if SQLAll[1]='A' then
StrCat(SQLTemp,Pchar(SQLAll)+3); SQLStr:=SQLStr+SQLTemp+' ORDER BY 设备编号,设备名称,型号,分类号,购置日期,现状,放置位置,附件总数';
FreeMem(SQLTemp);
Application.MessageBox(Pchar(SQLStr),'预查询的SQL语句',MB_OK); with DataModule1.ADOQuery1 do
begin
SQL.Clear;
SQL.Add(SQLStr);
ExecSQL;
Open; end;
begin
SQL.Clear;
SQL.Add(SQLStr);
Open;
end
begin
active:=false;
SQL.Clear;
SQL.Add(SQLStr);
Open;
end