D
dong1024
Unregistered / Unconfirmed
GUEST, unregistred user!
程序如下,我运行它第一次是没问题的,但我查完一个,再查一个的时候就不行了
它没出错,但查不到东西
procedure TForm_sblxcx.Button1Click(Sender: TObject);
var
querystr,
wherestr:string;
begin
if (length(trim(edit1.text))=0) then begin
querystr:='select num,sblx,sbmc from zcb'
end
else begin
with combobox1 do
case (combobox1.ItemIndex) of
0 : wherestr:='where num LIKE'+'''%'+edit1.text+'%''';
1 : wherestr:='where sblx LIKE'+'''%'+edit1.text+'%'';';
2 : wherestr:='where sbmc LIKE'+'''%'+edit1.text+'%'';';
end;
querystr:='select num,sblx,sbmc from zcb '+wherestr;
end;
with dm_sbgl.Query_cx do
begin
Close;
SQL.clear;
SQL.add(querystr);
open;
edit1.text:=' ';
end;
end;
它没出错,但查不到东西
procedure TForm_sblxcx.Button1Click(Sender: TObject);
var
querystr,
wherestr:string;
begin
if (length(trim(edit1.text))=0) then begin
querystr:='select num,sblx,sbmc from zcb'
end
else begin
with combobox1 do
case (combobox1.ItemIndex) of
0 : wherestr:='where num LIKE'+'''%'+edit1.text+'%''';
1 : wherestr:='where sblx LIKE'+'''%'+edit1.text+'%'';';
2 : wherestr:='where sbmc LIKE'+'''%'+edit1.text+'%'';';
end;
querystr:='select num,sblx,sbmc from zcb '+wherestr;
end;
with dm_sbgl.Query_cx do
begin
Close;
SQL.clear;
SQL.add(querystr);
open;
edit1.text:=' ';
end;
end;