Marco's Web Center

Menu for Development

Site Menu
Object Pascal Handbook
Delphi Handbooks Collection
Mastering Borland Delphi 2005
(Old) White Papers
(Old)Tools
(Old) Conferences

My Other Sites
Italian Site (www.marcocantu.it)
the delphi search

Spirit of delphi

Advertising
Home My Blog Books Object Pascal Marco

Home: Code Repository: Mastering Delphi 6

Chapter 15 - Project Ibemp2

Project Structure

Ibemp2.dpr
program Ibemp2;

uses
  Forms,
  IbEmpF in 'IbEmpF.pas' {FormEmp};

{$R *.RES}

begin
  Application.Initialize;
  Application.CreateForm(TFormEmp, FormEmp);
  Application.Run;
end.
IbEmpF.pas
unit IbEmpF;

interface

uses
  SysUtils, Windows, Messages, Classes, Graphics, Controls,
  StdCtrls, Forms, DBCtrls, DB, DBTables, Mask, ExtCtrls, IBDatabase,
  IBCustomDataSet, IBQuery, IBSQL;

type
  TFormEmp = class(TForm)
    ScrollBox: TScrollBox;
    DBNavigator: TDBNavigator;
    Panel1: TPanel;
    DataSource1: TDataSource;
    Panel2: TPanel;
    IBQuery1: TIBQuery;
    IBDatabase1: TIBDatabase;
    IBTransaction1: TIBTransaction;
    IBQuery1EMP_NO: TIntegerField;
    IBQuery1FIRST_NAME: TIBStringField;
    IBQuery1LAST_NAME: TIBStringField;
    IBQuery1PHONE_EXT: TIBStringField;
    IBQuery1HIRE_DATE: TDateTimeField;
    IBQuery1DEPT_NO: TIBStringField;
    IBQuery1JOB_CODE: TIBStringField;
    IBQuery1JOB_GRADE: TIntegerField;
    IBQuery1JOB_COUNTRY: TIBStringField;
    IBQuery1SALARY: TFloatField;
    IBQuery1FULL_NAME: TIBStringField;
    Label1: TLabel;
    DBEdit1: TDBEdit;
    Label2: TLabel;
    DBEdit2: TDBEdit;
    Label3: TLabel;
    DBEdit3: TDBEdit;
    Label4: TLabel;
    DBEdit4: TDBEdit;
    Label5: TLabel;
    DBEdit5: TDBEdit;
    Label6: TLabel;
    DBEdit6: TDBEdit;
    Label7: TLabel;
    DBEdit7: TDBEdit;
    Label8: TLabel;
    DBEdit8: TDBEdit;
    Label9: TLabel;
    DBEdit9: TDBEdit;
    Label10: TLabel;
    DBEdit10: TDBEdit;
    Label11: TLabel;
    DBEdit11: TDBEdit;
    procedure FormCreate(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  FormEmp: TFormEmp;

implementation

{$R *.DFM}

procedure TFormEmp.FormCreate(Sender: TObject);
begin
  IBQuery1.Open;
end;

end.
IbEmpF.dfm
object FormEmp: TFormEmp
  Left = 271
  Top = 173
  Width = 485
  Height = 323
  ActiveControl = Panel1
  Caption = 'InterBase Employee'
  Color = clBtnFace
  ParentFont = True
  OldCreateOrder = True
  Position = poScreenCenter
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object Panel1: TPanel
    Left = 0
    Top = 0
    Width = 477
    Height = 41
    Align = alTop
    TabOrder = 0
    object DBNavigator: TDBNavigator
      Left = 8
      Top = 8
      Width = 240
      Height = 25
      DataSource = DataSource1
      Flat = True
      Ctl3D = False
      ParentCtl3D = False
      TabOrder = 0
    end
  end
  object Panel2: TPanel
    Left = 0
    Top = 41
    Width = 477
    Height = 255
    Align = alClient
    BevelInner = bvLowered
    BorderWidth = 4
    Caption = 'Panel2'
    TabOrder = 1
    object ScrollBox: TScrollBox
      Left = 6
      Top = 6
      Width = 465
      Height = 243
      HorzScrollBar.Margin = 6
      HorzScrollBar.Range = 132
      VertScrollBar.Margin = 6
      VertScrollBar.Range = 236
      Align = alClient
      AutoScroll = False
      BorderStyle = bsNone
      TabOrder = 0
      object Label1: TLabel
        Left = 40
        Top = 24
        Width = 45
        Height = 13
        Caption = 'EMP_NO'
        FocusControl = DBEdit1
      end
      object Label2: TLabel
        Left = 40
        Top = 64
        Width = 68
        Height = 13
        Caption = 'FIRST_NAME'
        FocusControl = DBEdit2
      end
      object Label3: TLabel
        Left = 40
        Top = 104
        Width = 64
        Height = 13
        Caption = 'LAST_NAME'
        FocusControl = DBEdit3
      end
      object Label4: TLabel
        Left = 40
        Top = 144
        Width = 65
        Height = 13
        Caption = 'PHONE_EXT'
        FocusControl = DBEdit4
      end
      object Label5: TLabel
        Left = 40
        Top = 184
        Width = 61
        Height = 13
        Caption = 'HIRE_DATE'
        FocusControl = DBEdit5
      end
      object Label6: TLabel
        Left = 336
        Top = 24
        Width = 51
        Height = 13
        Caption = 'DEPT_NO'
        FocusControl = DBEdit6
      end
      object Label7: TLabel
        Left = 200
        Top = 24
        Width = 56
        Height = 13
        Caption = 'JOB_CODE'
        FocusControl = DBEdit7
      end
      object Label8: TLabel
        Left = 200
        Top = 64
        Width = 64
        Height = 13
        Caption = 'JOB_GRADE'
        FocusControl = DBEdit8
      end
      object Label9: TLabel
        Left = 200
        Top = 104
        Width = 79
        Height = 13
        Caption = 'JOB_COUNTRY'
        FocusControl = DBEdit9
      end
      object Label10: TLabel
        Left = 200
        Top = 144
        Width = 42
        Height = 13
        Caption = 'SALARY'
        FocusControl = DBEdit10
      end
      object Label11: TLabel
        Left = 200
        Top = 184
        Width = 63
        Height = 13
        Caption = 'FULL_NAME'
        FocusControl = DBEdit11
      end
      object DBEdit1: TDBEdit
        Left = 40
        Top = 40
        Width = 64
        Height = 21
        DataField = 'EMP_NO'
        DataSource = DataSource1
        TabOrder = 0
      end
      object DBEdit2: TDBEdit
        Left = 40
        Top = 80
        Width = 94
        Height = 21
        DataField = 'FIRST_NAME'
        DataSource = DataSource1
        TabOrder = 1
      end
      object DBEdit3: TDBEdit
        Left = 40
        Top = 120
        Width = 124
        Height = 21
        DataField = 'LAST_NAME'
        DataSource = DataSource1
        TabOrder = 2
      end
      object DBEdit4: TDBEdit
        Left = 40
        Top = 160
        Width = 28
        Height = 21
        DataField = 'PHONE_EXT'
        DataSource = DataSource1
        TabOrder = 3
      end
      object DBEdit5: TDBEdit
        Left = 40
        Top = 200
        Width = 112
        Height = 21
        DataField = 'HIRE_DATE'
        DataSource = DataSource1
        TabOrder = 4
      end
      object DBEdit6: TDBEdit
        Left = 336
        Top = 40
        Width = 49
        Height = 21
        DataField = 'DEPT_NO'
        DataSource = DataSource1
        TabOrder = 5
      end
      object DBEdit7: TDBEdit
        Left = 200
        Top = 40
        Width = 34
        Height = 21
        DataField = 'JOB_CODE'
        DataSource = DataSource1
        TabOrder = 6
      end
      object DBEdit8: TDBEdit
        Left = 200
        Top = 80
        Width = 64
        Height = 21
        DataField = 'JOB_GRADE'
        DataSource = DataSource1
        TabOrder = 7
      end
      object DBEdit9: TDBEdit
        Left = 200
        Top = 120
        Width = 94
        Height = 21
        DataField = 'JOB_COUNTRY'
        DataSource = DataSource1
        TabOrder = 8
      end
      object DBEdit10: TDBEdit
        Left = 200
        Top = 160
        Width = 64
        Height = 21
        DataField = 'SALARY'
        DataSource = DataSource1
        TabOrder = 9
      end
      object DBEdit11: TDBEdit
        Left = 200
        Top = 200
        Width = 226
        Height = 21
        DataField = 'FULL_NAME'
        DataSource = DataSource1
        TabOrder = 10
      end
    end
  end
  object DataSource1: TDataSource
    DataSet = IBQuery1
    Left = 385
    Top = 9
  end
  object IBQuery1: TIBQuery
    Database = IBDatabase1
    Transaction = IBTransaction1
    BufferChunks = 1000
    CachedUpdates = False
    SQL.Strings = (
      'SELECT * FROM EMPLOYEE')
    Left = 302
    Top = 7
    object IBQuery1EMP_NO: TIntegerField
      FieldName = 'EMP_NO'
      Required = True
    end
    object IBQuery1FIRST_NAME: TIBStringField
      FieldName = 'FIRST_NAME'
      Required = True
      Size = 15
    end
    object IBQuery1LAST_NAME: TIBStringField
      FieldName = 'LAST_NAME'
      Required = True
    end
    object IBQuery1PHONE_EXT: TIBStringField
      FieldName = 'PHONE_EXT'
      Size = 4
    end
    object IBQuery1HIRE_DATE: TDateTimeField
      FieldName = 'HIRE_DATE'
      Required = True
    end
    object IBQuery1DEPT_NO: TIBStringField
      FieldName = 'DEPT_NO'
      Required = True
      Size = 3
    end
    object IBQuery1JOB_CODE: TIBStringField
      FieldName = 'JOB_CODE'
      Required = True
      Size = 5
    end
    object IBQuery1JOB_GRADE: TIntegerField
      FieldName = 'JOB_GRADE'
      Required = True
    end
    object IBQuery1JOB_COUNTRY: TIBStringField
      FieldName = 'JOB_COUNTRY'
      Required = True
      Size = 15
    end
    object IBQuery1SALARY: TFloatField
      FieldName = 'SALARY'
    end
    object IBQuery1FULL_NAME: TIBStringField
      FieldKind = fkInternalCalc
      FieldName = 'FULL_NAME'
      ReadOnly = True
      Size = 37
    end
  end
  object IBDatabase1: TIBDatabase
    DatabaseName =
       'C:\Program Files\InterBase Corp\InterBase6\examples\Database\emp' +
      'loyee.gdb'
    Params.Strings = (
      'user_name=SYSDBA'
      'password=masterkey')
    LoginPrompt = False
    IdleTimer = 0
    SQLDialect = 1
    TraceFlags = []
    Left = 344
    Top = 8
  end
  object IBTransaction1: TIBTransaction
    Active = False
    DefaultDatabase = IBDatabase1
    AutoStopAction = saNone
    Left = 264
    Top = 8
  end
end