unit1.pas

来自「DELPHI7编程百例 DELPHI7编程百例 DELPHI7编程百例」· PAS 代码 · 共 53 行

PAS
53
字号
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    DataSource1: TDataSource;
    Button1: TButton;
    Edit1: TEdit;
    Database1: TDatabase;
    Label1: TLabel;
    Query1: TQuery;
    DBGrid1: TDBGrid;
    Label2: TLabel;
    StoredProc1: TStoredProc;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  with StoredProc1 do
  begin
    Prepare;
    Parambyname('iCOUNTRY').AsString:=Edit1.Text;
    ExecProc;
    GetResults;
    Label2.Caption:='查询国家名称为'+Params[0].AsString+'的记录            ';
  end;
  with Query1 do
  begin
    close;
    Parambyname('iCOUNTRY').AsString:=Edit1.Text;
    open;
  end;
end;

end.

⌨️ 快捷键说明

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