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 5

Project ADOMD

Project Structure


ADOMD.DPR

program AdoMd;

uses
  Forms,
  AdoMDForm in 'AdoMDForm.pas' {Form1};

{$R *.RES}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

ADOMDFORM.PAS

unit AdoMDForm;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Db, ADODB, Grids, DBGrids, StdCtrls, Mask, DBCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    ADOTable1: TADOTable;
    ADOTable2: TADOTable;
    ADOConnection: TADOConnection;
    ADODataSet3: TADODataSet;
    DataSource1: TDataSource;
    DataSource2: TDataSource;
    DataSource3: TDataSource;
    ADOTable1CustNo: TFloatField;
    ADOTable1Company: TWideStringField;
    ADOTable1Addr1: TWideStringField;
    ADOTable1Addr2: TWideStringField;
    ADOTable1City: TWideStringField;
    ADOTable1State: TWideStringField;
    ADOTable1Zip: TWideStringField;
    ADOTable1Country: TWideStringField;
    ADOTable1Phone: TWideStringField;
    ADOTable1FAX: TWideStringField;
    ADOTable1TaxRate: TFloatField;
    ADOTable1Contact: TWideStringField;
    ADOTable1LastInvoiceDate: TDateField;
    Label1: TLabel;
    DBEdit1: TDBEdit;
    Label2: TLabel;
    DBEdit2: TDBEdit;
    Label3: TLabel;
    DBEdit3: TDBEdit;
    Label4: TLabel;
    DBEdit4: TDBEdit;
    Label5: TLabel;
    DBEdit5: TDBEdit;
    DBGrid1: TDBGrid;
    DBGrid2: TDBGrid;
    DBNavigator1: TDBNavigator;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
  AdoTAble1.Open;
  Adotable2.Open;
  AdoDataSet3.Open;
end;

end.

ADOMDFORM.DFM

object Form1: TForm1
  Left = 271
  Top = 107
  Width = 476
  Height = 519
  Caption = 'AdoMd'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 288
    Top = 8
    Width = 35
    Height = 13
    Caption = 'CustNo'
    FocusControl = DBEdit1
  end
  object Label2: TLabel
    Left = 32
    Top = 40
    Width = 44
    Height = 13
    Caption = 'Company'
    FocusControl = DBEdit2
  end
  object Label3: TLabel
    Left = 240
    Top = 40
    Width = 17
    Height = 13
    Caption = 'City'
    FocusControl = DBEdit3
  end
  object Label4: TLabel
    Left = 32
    Top = 80
    Width = 25
    Height = 13
    Caption = 'State'
    FocusControl = DBEdit4
  end
  object Label5: TLabel
    Left = 240
    Top = 80
    Width = 36
    Height = 13
    Caption = 'Country'
    FocusControl = DBEdit5
  end
  object DBEdit1: TDBEdit
    Left = 288
    Top = 24
    Width = 64
    Height = 21
    DataField = 'CustNo'
    DataSource = DataSource1
    TabOrder = 0
  end
  object DBEdit2: TDBEdit
    Left = 32
    Top = 56
    Width = 184
    Height = 21
    DataField = 'Company'
    DataSource = DataSource1
    TabOrder = 1
  end
  object DBEdit3: TDBEdit
    Left = 240
    Top = 56
    Width = 193
    Height = 21
    DataField = 'City'
    DataSource = DataSource1
    TabOrder = 2
  end
  object DBEdit4: TDBEdit
    Left = 32
    Top = 96
    Width = 185
    Height = 21
    DataField = 'State'
    DataSource = DataSource1
    TabOrder = 3
  end
  object DBEdit5: TDBEdit
    Left = 240
    Top = 96
    Width = 193
    Height = 21
    DataField = 'Country'
    DataSource = DataSource1
    TabOrder = 4
  end
  object DBGrid1: TDBGrid
    Left = 32
    Top = 128
    Width = 401
    Height = 153
    DataSource = DataSource2
    TabOrder = 5
    TitleFont.Charset = DEFAULT_CHARSET
    TitleFont.Color = clWindowText
    TitleFont.Height = -11
    TitleFont.Name = 'MS Sans Serif'
    TitleFont.Style = []
  end
  object DBGrid2: TDBGrid
    Left = 32
    Top = 288
    Width = 401
    Height = 177
    DataSource = DataSource3
    TabOrder = 6
    TitleFont.Charset = DEFAULT_CHARSET
    TitleFont.Color = clWindowText
    TitleFont.Height = -11
    TitleFont.Name = 'MS Sans Serif'
    TitleFont.Style = []
  end
  object DBNavigator1: TDBNavigator
    Left = 32
    Top = 8
    Width = 234
    Height = 25
    DataSource = DataSource1
    VisibleButtons = [nbFirst, nbPrior, nbNext, nbLast, nbInsert, nbDelete, nbEdit, nbPost, nbCancel]
    TabOrder = 7
  end
  object ADOTable1: TADOTable
    Connection = ADOConnection
    TableName = 'customer'
    Left = 336
    Top = 152
    object ADOTable1CustNo: TFloatField
      FieldName = 'CustNo'
    end
    object ADOTable1Company: TWideStringField
      FieldName = 'Company'
      Size = 30
    end
    object ADOTable1Addr1: TWideStringField
      FieldName = 'Addr1'
      Size = 30
    end
    object ADOTable1Addr2: TWideStringField
      FieldName = 'Addr2'
      Size = 30
    end
    object ADOTable1City: TWideStringField
      FieldName = 'City'
      Size = 15
    end
    object ADOTable1State: TWideStringField
      FieldName = 'State'
    end
    object ADOTable1Zip: TWideStringField
      FieldName = 'Zip'
      Size = 10
    end
    object ADOTable1Country: TWideStringField
      FieldName = 'Country'
    end
    object ADOTable1Phone: TWideStringField
      FieldName = 'Phone'
      Size = 15
    end
    object ADOTable1FAX: TWideStringField
      FieldName = 'FAX'
      Size = 15
    end
    object ADOTable1TaxRate: TFloatField
      FieldName = 'TaxRate'
    end
    object ADOTable1Contact: TWideStringField
      FieldName = 'Contact'
    end
    object ADOTable1LastInvoiceDate: TDateField
      FieldName = 'LastInvoiceDate'
    end
  end
  object ADOTable2: TADOTable
    Connection = ADOConnection
    IndexFieldNames = 'CustNo'
    MasterFields = 'CustNo'
    MasterSource = DataSource1
    TableName = 'orders'
    Left = 336
    Top = 208
  end
  object ADOConnection: TADOConnection
    ConnectionString = 'FILE NAME=C:\md5code\Part3\12\data\MdData.UDL'
    LoginPrompt = False
    Provider = 'C:\md5code\Part3\12\data\MdData.UDL'
    Left = 336
    Top = 320
  end
  object ADODataSet3: TADODataSet
    Connection = ADOConnection
    CommandText = 'items'
    CommandType = cmdTable
    DataSource = DataSource2
    IndexFieldNames = 'OrderNo'
    MasterFields = 'OrderNo'
    Parameters = <>
    Left = 336
    Top = 264
  end
  object DataSource1: TDataSource
    DataSet = ADOTable1
    Left = 392
    Top = 152
  end
  object DataSource2: TDataSource
    DataSet = ADOTable2
    Left = 392
    Top = 208
  end
  object DataSource3: TDataSource
    DataSet = ADODataSet3
    Left = 392
    Top = 264
  end
end