Unit1.pas
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Db, ADODB, Grids, DBGrids;
type
TForm1 = class(TForm)
ADOConnection1: TADOConnection;
DataSource1: TDataSource;
DataSource2: TDataSource;
DBGrid1: TDBGrid;
DBGrid2: TDBGrid;
ADODataSet1: TADODataSet;
ADODataSet2: TADODataSet;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
end.
Unit1.dfm
object Form1: TForm1
Left = 212
Top = 305
Width = 544
Height = 375
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object DBGrid1: TDBGrid
Left = 0
Top = 160
Width = 521
Height = 120
DataSource = DataSource1
TabOrder = 0
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = []
end
object DBGrid2: TDBGrid
Left = 0
Top = 32
Width = 525
Height = 120
DataSource = DataSource2
TabOrder = 1
TitleFont.Charset = DEFAULT_CHARSET
TitleFont.Color = clWindowText
TitleFont.Height = -11
TitleFont.Name = 'MS Sans Serif'
TitleFont.Style = []
end
object ADOConnection1: TADOConnection
Connected = True
ConnectionString =
'Provider=Microsoft.Jet.OLEDB.4.0;Password="";User ID=Admin;Data ' +
'Source=C:\Program Files\Common Files\Borland Shared\Data\dbdemos' +
'.mdb;Mode=ReadWrite;Extended Properties="";Jet OLEDB:System data' +
'base="";Jet OLEDB:Registry Path="";Jet OLEDB:Database Password="' +
'";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet ' +
'OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactio' +
'ns=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create System ' +
'Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don'#39't ' +
'Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica R' +
'epair=False;Jet OLEDB:SFP=False'
LoginPrompt = False
Mode = cmReadWrite
Provider = 'Microsoft.Jet.OLEDB.4.0'
end
object DataSource1: TDataSource
DataSet = ADODataSet1
Left = 60
end
object DataSource2: TDataSource
DataSet = ADODataSet2
Left = 116
end
object ADODataSet1: TADODataSet
Active = True
Connection = ADOConnection1
CursorType = ctStatic
CommandText = 'items'
CommandType = cmdTable
DataSource = DataSource2
IndexFieldNames = 'OrderNo'
MasterFields = 'OrderNo'
Parameters = <>
Left = 28
end
object ADODataSet2: TADODataSet
Active = True
Connection = ADOConnection1
CursorType = ctStatic
CommandText = 'orders'
CommandType = cmdTable
Parameters = <>
Left = 88
end
end
Для примера используются таблицы Items и Orders из C:\Program Files\Common Files\Borland Shared\Data\dbdemos.mdb