⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 searchbjinfosrc.~pas

📁 报警地图电子显示源代码
💻 ~PAS
字号:
unit SearchBJInfoSrc;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Grids, DBGrids, DB, ADODB;

type
  TFormSearchBJInfo = class(TForm)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    ComboBoxSearchBJInfo: TComboBox;
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    DBGrid1: TDBGrid;
    procedure ButtonCloseClick(Sender: TObject);
    procedure ComboBoxSearchBJInfoChange(Sender: TObject);
    procedure ButtonOKClick(Sender: TObject);
    procedure FormActivate(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormSearchBJInfo: TFormSearchBJInfo;

implementation

{$R *.dfm}
uses
   BJInfoSrc;

procedure TFormSearchBJInfo.ButtonCloseClick(Sender: TObject);
begin
       Close;
end;

procedure TFormSearchBJInfo.ComboBoxSearchBJInfoChange(Sender: TObject);
begin
       Edit1.Text := '';       
end;

procedure TFormSearchBJInfo.ButtonOKClick(Sender: TObject);
var
     strSQL:string;
begin
     strSQL := 'select * from BJJLB where ' + ComboBoxSearchBJInfo.text + ' like ' + '"%'+ Edit1.Text + '%"';
     FormBJInfo.ADOQuery1.Close;
     FormBJInfo.ADOQuery1.SQL.Clear;
     FormBJInfo.ADOQuery1.SQL.Text := strSQL;
     FormBJInfo.ADOQuery1.Open;
end;

procedure TFormSearchBJInfo.FormActivate(Sender: TObject);
var i,num:Integer;
    str:string;
    strSQL:string;
begin
        ComboBoxSearchBJInfo.Clear;
        strSQL := 'select * from BJJLB';
        FormBJInfo.ADOQuery1.Close;
        FormBJInfo.ADOQuery1.SQL.Clear;
        FormBJInfo.ADOQuery1.SQL.Text := strSQL;
        FormBJInfo.ADOQuery1.ExecSQL;
        FormBJInfo.ADOQuery1.Open;
        num:=FormBJInfo.ADOQuery1.FieldCount;
        for i:=0 to num-1 do
        begin
          str:=FormBJInfo.ADOQuery1.FieldList.Strings[i];
          ComboBoxSearchBJInfo.Items.Add(str);
        end;
        ComboBoxSearchBJInfo.ItemIndex := 0;
        Edit1.Text := '';
        strSQL := 'select * from BJJLB';
        FormBJInfo.ADOQuery1.Close;
        FormBJInfo.ADOQuery1.SQL.Clear;
        FormBJInfo.ADOQuery1.SQL.Text := strSQL;
        FormBJInfo.ADOQuery1.Open;
        Edit1.Text := '';
        //DBGrid1.ReadOnly := true;
end;

procedure TFormSearchBJInfo.Button3Click(Sender: TObject);
var
     strSQL:string;
begin
     strSQL := 'select * from BJJLB';
     FormBJInfo.ADOQuery1.Close;
     FormBJInfo.ADOQuery1.SQL.Clear;
     FormBJInfo.ADOQuery1.SQL.Text := strSQL;
     FormBJInfo.ADOQuery1.Open;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -