if fieldbyname('所属').AsString <>'' then
begin
LISTBOX1.Items.Add(fieldbyname('所属').AsString);
end;
qPOST.Next ;
end;
end;
end;
end;
procedure TBM_POSTF.FormCreate(Sender: TObject);
begin
int2;
end;
procedure TBM_POSTF.ListBox1Click(Sender: TObject);
VAR
sql1:string;
begin
sql1:='select * from 邮编电话 where 所属="'+LISTBOX1.Items.Strings[LISTBOX1.ItemIndex]+'"';
with qPOST2 do
begin
close;
sql.Clear ;
sql.Add(sql1);
Open ;
StatusBar1.SimpleText :='共有'+ inttostr(qPOST2.recordcount) +'条记录!';;
end;
end;
procedure TBM_POSTF.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
inherited;
With DbGrid1 do
begin
if ((State = [gdSelected]) or (State = [gdSelected,gdFocused])) then
begin
Canvas.Font.Color := clYellow;
Canvas.Brush.Color := clNavy;
end
else
begin
if DataCol mod 2 <> 0 then Canvas.Brush.Color := clWhite
else Canvas.Brush.Color := $00EAEAEA;
end;
DefaultDrawColumnCell(Rect,DataCol,Column,State);
end;
end;
procedure TBM_POSTF.SpeedButton1Click(Sender: TObject);
VAR
sql1:string;
begin
sql1:='select 所属,地区名称,邮政编码,电话区号 from 邮编电话 ';
if edit1.Text <>'' then
begin
sql1:=sql1+'where 所属="'+edit1.Text +'"';
if edit2.Text <>'' then sql1:=sql1+' and 地区名称="'+edit2.Text +'"';
if edit3.Text <>'' then sql1:=sql1+' and 邮政编码="'+edit3.Text +'"';
if edit4.Text <>'' then sql1:=sql1+' and 电话区号="'+edit4.Text +'"';
end
else
///////////////////////////
if edit2.Text <>'' then
begin
sql1:=sql1+' where 地区名称="'+edit2.Text +'"';
if edit3.Text <>'' then sql1:=sql1+' and 邮政编码="'+edit3.Text +'"';
if edit4.Text <>'' then sql1:=sql1+' and 电话区号="'+edit4.Text +'"';
end
else//////////////////////
if edit3.Text <>'' then
begin
sql1:=sql1+' where 邮政编码="'+edit3.Text +'"';
if edit4.Text <>'' then sql1:=sql1+' and 电话区号="'+edit4.Text +'"';
end
else
if edit4.Text <>'' then sql1:=sql1+' where 电话区号="'+edit4.Text +'"';
with qPOST2 do
begin
close;
sql.Clear ;
sql.Add(sql1);
Open ;
StatusBar1.SimpleText :='共有'+ inttostr(qPOST2.recordcount) +'条记录!';;
end;
end;
procedure TBM_POSTF.SpeedButton2Click(Sender: TObject);
begin
close;
end;
procedure TBM_POSTF.FormClose(Sender: TObject; var Action: TCloseAction);
begin
action:=cafree;
end;
procedure TBM_POSTF.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
canclose:=true;
end;
end.
<< 上一页 [21] [22] [23] [24] [25] [26] 下一页