我正在写一个关于人事管理的一个小程序,主要就是查询,我数据库的内容是从电子表格中导入的!但是在查询的时候,我选择查询全部不能查询出来,只能出现一部分记录。不知道怎么回事!请教各位了!
procedure TForm1.Button1Click(Sender: TObject);
var
dw1,xl1,mm1,xm1,zy1,sf1,yx1,dwmz:String;
i:Integer;
begin
dwmz:=Trim(ComboBox1.Text);
with DM.ZXADO do
begin
if dwmz='全部' then
begin
SQL.Clear;
SQL.Add('select * from rszx');
Prepared;
Open;
end
else
begin
SQL.Clear;
SQL.Add('select * from rszx where dw1 like:dw and xl like:xl1 and mm like:mm1 and xm like:xm1 and zy like:zy1 and sf like:sf1 and yx like:yx1');
Parameters.ParamValues['dw1']:='%'+dwmz+'%';
Parameters.ParamValues['xl1']:='%'+xledit.text+'%';
Parameters.ParamValues['xm1']:='%'+xmedit.text+'%';
Parameters.ParamValues['mm1']:='%'+mmedit.text+'%';
Parameters.ParamValues['zy1']:='%'+zyedit.text+'%';
Parameters.ParamValues['sf1']:='%'+sfedit.text+'%';
Parameters.ParamValues['yx1']:='%'+yxedit.text+'%';
Prepared;
Open;
Last;
i:=RecordCount;
Label9.Caption:=inttostr(i);
end;
end;
end;
这个就是我查询的代码!请大家给我看看是怎么回事呀!谢谢大家!急急急!!!!
procedure TForm1.Button1Click(Sender: TObject);
var
dw1,xl1,mm1,xm1,zy1,sf1,yx1,dwmz:String;
i:Integer;
begin
dwmz:=Trim(ComboBox1.Text);
with DM.ZXADO do
begin
if dwmz='全部' then
begin
SQL.Clear;
SQL.Add('select * from rszx');
Prepared;
Open;
end
else
begin
SQL.Clear;
SQL.Add('select * from rszx where dw1 like:dw and xl like:xl1 and mm like:mm1 and xm like:xm1 and zy like:zy1 and sf like:sf1 and yx like:yx1');
Parameters.ParamValues['dw1']:='%'+dwmz+'%';
Parameters.ParamValues['xl1']:='%'+xledit.text+'%';
Parameters.ParamValues['xm1']:='%'+xmedit.text+'%';
Parameters.ParamValues['mm1']:='%'+mmedit.text+'%';
Parameters.ParamValues['zy1']:='%'+zyedit.text+'%';
Parameters.ParamValues['sf1']:='%'+sfedit.text+'%';
Parameters.ParamValues['yx1']:='%'+yxedit.text+'%';
Prepared;
Open;
Last;
i:=RecordCount;
Label9.Caption:=inttostr(i);
end;
end;
end;
这个就是我查询的代码!请大家给我看看是怎么回事呀!谢谢大家!急急急!!!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货