Вы находитесь на странице: 1из 77

DELPHI

..

2001

681.3 (076)
737
79

, ,
.. .
- c .


Delphi:

/ . .. .: , 2001.-77 c.
C
.

Delphi.


,
.
522800 522300,
.

681.39(76)
737

, 2001

1


, -
, .
,
.
.
DBD 7.0
.
, , , ,
DELPHI.
,
. ,
. , , ,
. .

1) :
-
.
, ,

.
Field Name - .
- . ,
.
Size - ,
(, ).
Key - ,
.

.
Paradox :
25 ;
, ,
;
(
);
: , (), | ( ) !
( );
, SQL-,
SELECT COUNT.

2) :
, . . ,
, ,
:
A (Alpha) - 1
255;
N (Number) -
-10(^307) 10(^308) 15 ;
+ () - (), (
);
$ (Money) - ,
(Number),
;
S (Short) - -32767 32767;
I (Long Integer) - -2147483648
2147483647;
# (BCD) - 0 32
;
D (Date) - 1 9999 . . 31 9999
. .;
T (Time) - , 24
;
@ (Timestamp) - , ;
M (Memo) - ,
( 1 240) ;
F (Formatted Memo) -
, ( 0 240) ;
G (Graphic) -
BMP;
O (OLE) - OLE - ;
L (Logical) - ,
True False;
+ (Autoincrement) - ( Long Integer,
),
;
B (Binary) - ,
; DBD 7.0 ;
Y (Bytes) - ,
; DBD 7.0 .
3) :
,
, Enter
Tab. .


. ,
, ,
. Insert.
Ctrl-Del.
, . .
.

- . ,
,
, , ,
.
4) :
.

F4 .
Shift+Tab.
,
.
Validity Checks ( )

.
. ,

. :
1. Required Field ( ).
, .
.
2. Minimum Value ( ). ,
,
.
3. Maximum Value ( ). ,
,
.
4. Default Value ( ).

.
5. Picture (). ,
.
, .

, Assist
().
Table Lookup ( - )

,

.
Secondary Indexes ( )
(
),
.
, ,
.
.
. .
, (
),
.
Referential Integrity ( )

.


,
.
,
,
.
,
,
.
Password Security ( )
,
.
,
, , .
Table Language ( )
,

.
BDE.
Dependent Table ( )
,
.
Referential Integraty ( ).
DBD 7.0
.
Table|Restructure,

.
, .

,
.
.
.
- ,
- (), ,
.
.
. ,

,
.
, ,
, .
: -,
,
; -, .
,
() .
,
, . (
) ,
.

,
.
, (
), .
1.


. , ,
, , , .

People.
People

#
IDPeople
,

Family

30

Name

SecName

Birthday

Sex

Notes
Memo

15
15

100

IDPeople,
.
,
People, Tel.
, , .
,
, .
, ,
.
Tel,
People.
Tel

#
IDTel

IDPeople 4

Number 9


TypeTel 4

IDPeople - ,
,
.
,
People Tel. People ,
IDPeople .
:
1. DataBase Desktop 7.0.
File|New|Table. Create Table
Paradox 7.0.
Paradox 7, .
Create Paradox 7 Table (Untitled),
. People.
2.

2.1. , Field
Name, IDPeople ab
.
2.2. Type
+(Autoincrement), Tab
.
2.3. Key ,
( Key ).
2.4.
Required field
( ), Key
Tab ,
.
,
; Family, Name, SecName Notes
Size , Required
field Family Sex. ,
, Key
. Birthday Picture ()
.
, Assist ().
Picture () ,
Verify Sintax ( ),
Sample Value ( )
. Test Value
( ),
.
#[#]:#[#]:#[#] {AM,PM};, #[#]/#[#]/#[#] - , -
Sample Picture ( ) Use.
Picture , #[#]/#[#]/#[#], . .
. .
3. People.db
Save As, Display Table
( ) Options ,
.
4. .
Table|Edit Data F9.
.
, Tab.
5. Tel.
, People,
Tel , -
IDPeople,
:
5.1. Table Properties
Secondary Indexes.

5.2. Define.
5.3. Define Secondary Index Field
IDPeople, ,
.
5.4. Save Index As
IDPeopleIndex .
6. Tel.db.
7. .
7.1. ,
.
File|Working Directory
.
7.2. Tel.db.
7.4. Table|Restructure, ,
.
7.5. Table Properties
Referential Integrity.
7.6. Define.
7.7. Referential Integrity Field
IDPeople[I],
.
7.8. Table People,
.
.
Referential Integrity.
7.10. Save Referential Integrity As
PeoplesTel, .
,
, .
7.11. Save.
8. , Table|Edit
Data.
9. File|Close Tel.db.

2.

1. People.db.
2. Table Edit Data.
.
3.
.
4. .

5. Insert
Record|Insert.
.
6. .
Ctrl+Del Record|Delete.

, Pack Table
( ) .
Table|Restructure, Restructure Paradox 7.0 for Windows Table:
People.db. Save
().
7.

Record,
, Record.
8. Tel.db .
,
,
.
.

.

- .
,
.
, ,
- .
, ,
.
3. People

1. Tools|Utilities|Sort.
2. Select Table ( )
, , - People.db.
Open, Sort Table:...People.db.
3. Sorted Table ( )
New Table ( ).
, , People-s.
4. Display sorted table (
) ,
. Sort just selected
fields ( ) , .

. , . . ,
Fields, , Sort
Oder.
5. : - Fields -
, , - Sort Oder - ,
. Family ,
,
.
6. Family, ,
Sort Oder.
Sort
Direction (
Sort Oder). ,
, - Change oder.
7. .
,
, .

1
1. ,
, 1:1, 1:N
(N:1).
1.
.
: , , ,
, ,
, , ,
.
2.
.
: , , ,
, , .
3.
.
: , , , ,
, , ,
,
0 1 ( ).
4.
.
: , , , ,
, .
, ,
.

5.
, .
: , , ,
, ,
.
6.
, , , .
: , ,
, , ,
.
7.
.
: , , ,
, , ( ),
( ).
8.
.
: , , ,
, ,
, .
9.
.
: , , ,
, ,
.
10.
5 . : ,
, , , , , ,
, .
11.
.
: , , , ,
, .
12.
.
: , , ,
, ,
.
13.
.
: , , ,
, , ,
, .
14.

.
: , , ,
, , ,
(1 , 0 ).
15.
.
: , ,
-, ,
,
.
16.
.
: ,
, , , -,
, .
17.
.
: , ,
, , ,
, , .
18.
.
.
,
. ,
.
:
, , , ,
.
19.
.
: , , , , ,
, ,
.
20.
.
: , ,
, , (,
..), ,
(, )
.
21.
.
: , , , , ,
, ,

, , ,
.
22.
.
: , , , , ,
, , ,
, , , ,
.
23.
.
: , , , , ,
, ,

.
24.
.
: , , ,
, , , -,
(1,2,3).
2. .
3. - ,
.
4. , .

Delphi
.
, ,
.

.
:
-. ,
. ,
DBGrid. ,
. ,
.
-. ,
.
, ,

.
. ,
.
.
, -
, .
,
.

, .
, -
, ,
. ,
, ,
.

. ,
,
.

1.

1. File|New
Application. Caption () Form1
.
.
2. Form1 MyExunitDB.pas, MyExampleDB.dpr.
File|Save Project As. ,
, MyExUnitDB,
MyExampleDB.
3. Form1 ,
People.db.
3.1. DataAccess (
) Form1
Table (). TableName
People.db,

People.db.
,
Active Table1 True.
3.2.
Form1 DataSource ( ).
.
DataSet DataSource1
Table1. ,
,
People.db. .
4. Form1 ,
Tel.db, ,
, Table2 DataSource2
Tel.db DatabaseName DataSet
.
5.
, .
Table2 Form1.
MasterSource DataSource1.
MasterFields .
Available Index ( )
IDPeopleIndex, ..
.
IDPeople ( Tel,
) IDPeople (
People). Add -
. ,
Delete,
.
. IndexName

- IDPeopleIndex, MsterFields ,
, - IDPeople.
6. Form1 ,
. :
6.1. Standart
Form1 Label ().
Caption , , .
6.2. DataControls ,
Form1 3 DBEdit ( )
Label1 .
DataSource DataSource1, DataField
Family,
Name SecName.
6.3. Standart
Label. DBEdit1.
Caption .
6.4. DataControls
DBEdit. DataSource
DataSource1, DataField
Birthday.
6.5. DataControls
DBCheckBox (
). Alignment ()
DBCheckBox1 LeftJustify, Caption - .
DataSource DataSource1, DataField
Sex.
6.6. Label2 Standart
Label. Caption
.
6.7. Dataontrols
DBMemo ( ).
,

. DataSource
DataSource1, DataField Notes.
6.8. Form1
DataControls DBNavigator ( ).
. DataSource
DataSopurce1.
7. Form1 DataControls DBGrid
( ). ,
, .
DataSource DataSource2.
, DBGrid1
Tel.db.

8. ,
DBGrid. :
8.1. Columns,
Editing DBGrid1.Columns.
8.2. Add.
0-TColumn.
FieldName Number. Titel
Caption .
8.3. Add.
1-TColumn.
FieldName Type.
PickList :
.
.
.
, .
Titel Caption .
,
DBGrid1 .
8.4. ,
,
.
9. Standart Form1
Label. DBGrid1 .
Caption .
10. DataControls Form1
DBNavigator. DBGrid1 .
DataSource DataSource2.
11. Run|Run.
12.
. , .
:
12.1.
. People,
.
, ,
, , .
14.01.79.
.
.
People.
,
,
, .

,
DBGrid1 DBNavigator2.
:
12.1.1. .
DBNavigator1 . Events
.
12.1.2.
BeforeAction. MyExUnitDB.pas
Form1.DBNavigator1BeforeAction :
if ((Button=nbInsert) or (Button=nbEdit)) then
begin
DBNavigator2.Enabled:=false;
DBGrid1.Enabled:=false;
end;
if Button=nbPost then
begin
DBNavigator2.Enabled:=true;
DBGrid1.Enabled:=true;
end;
12.1.3. .
12.2.
. Tel.
.
, . .
12.3.
.
:

, .
.
.
Tel.
13.
.
14. File|Save All.
:
1. - DBGrid1,

. -
DBGrid1 ,
,
.
2. People
Tel, ,
People.

Form1.DBNavigator1BeforeAction
:
if Button=nbDelete then
begin
Table2.First;
while not Table2.Eof do
begin
Table2.Delete;
end;
end;
, . 12.1.

- FormWizard
FormWizard - , ,
,
.
DataBase|FormWizard
File|New|Bisuness|DataBase Form Wizard.
1.
.
. :
Form Options ( )
:
Create simple form ( ) - ,
;
Create master detail form ( ) - ,
.
DataSet Options ( ) ,
:
Create a form using TTable object (
Table) - ;
Create a form using TQuery object (
Query) -
SQL.
2.
, ,
.
3.
, ,
.
. ,
, -

.
.
4.
:
Horizontally () - ;
Vetically () - ;
In a grid () -
( DBGrid).

:

, , .2.4;
,
,
(.6);
,
(.7).
5.
:
Left () - ;
Top () - .
6.
.
Availabel
Indexes ( ),
.
3 . , Detail Fields (
), , ,
. , Master Fields (
), - , ,
.
,
Add (). , Joined Fields
( ), , ,
.
Clear () .
Delete ()
.
,
.
7.
Generate a main form ( )
.

Form Generation ( ) ,
Tabel (Query)
DataSource. :
Form Only ( ) -
, .
Form and DataModule ( DataModule) -

DataModule c .
Navigator.

Finish ().
.
2.

Form Wizard.
( 1
2).
(Fields Editor) ( TField)
Fields Editor
. ,
, , ,
. Fields Editor

, .
.

3.

1. , MyExUnitDB.dpr,
File|Open.
2. (
IDPeople). ,
,
.
:
2.1. Form1 Table1.
,
Add Fields. ,
, IDPeople.
. DisplayFormat
:

: 000
2.2. DataControls ,
Form1, ,
DBEdit. ,
.
, DataSource DataSource1,
DataField IDPeople.
, DBEdit5
.
3.
DBCheckBox1, .
.
:
3.1. Form1 Table1.
Sex.
. DisplayValues :
;
3.2. Form1 DBCheckBox1,
Del. DataControls
, DBComboBox
( )
. ,
DataSource DataSource1, DataField
Sex. ,
DBComboBox1
( ).
DBComboBox1
Items
:

.
3.3. Standart,
Label. ,
Caption .
4. .
:
4.1. Form1 Table1.
Birthday.
.
4.2. DisplayFormat
- , dddddd.
Enter.
5. Run|Run.
.

6. , ,
,
.
, .
, .
7. ,
.
8.
File|Save All.

2
1. , (),
:
1.
(DBComboBox).
2.

(DBComboBox).
3.
-
(DBComboBox).
4.
- (DBComboBox).
, :
15 1998 .
5.
- (DBComboBox).
(DBRadioGroup).
6.
- (DBRadioGroup).
7.
, :
1990 .

(DBCheckBox).
8.
-
(DBComboBox).
9.
(DBComboBox).
- (DBRadioGroup).
10.
(DBComboBox).
, :
1980 .

11.
-
(DBComboBox).
12.
, :
15 1998 .
13.
, :
15 1998 .
- (DBRadioGroup).
14.
-
(DBCheckBox).
-
(DBCheckBox).
15.
, :
15 1998 .
, -
(DBRadioGroup).
-
(DBComboBox).
16.
,
:
15 1998 .
17.
, :
15 1998 .
18.
-
(DBComboBox).
19.
- (DBRadioGroup).
, :
15 1998 .
20.
- (DBCheckBox).
-
(DBComboBox).
21.
- (DBComboBox).
-
(DBComboBox).

, :
15 1998 .
22.
- (DBComboBox).
,
:
15 1998 .
23.
- (DBRadioGroup).
, :
15 1998 .
24.
-
(DBComboBox).
, :
15 1998 .
- (DBRadioGroup).
2. () ,
:
1.
(
).
2.
.
3.
, .
4.
, .
5.
.
6.
.
7.
.
8.
, .
9.
, .
10.
.
11.
.
12.

.
13.
,
.
14.
.
15.


.
16.
( ).
17.
.
18.
.
19.
.
20.
, .
21.
, .
22.
, .
23.
.
24.
.
3. ()
FormWizard.

, .
. ,
, .
Delphi
.
, .
,
.
. Delphi 3.0
QuickReport 2.0,
, , .
, , :
,
.
.

.

,
.
.
.
.
.
. .
.
,
.
.
.

: ,
, ,
, , ,
, . , QuickReport
,
, .
, .
1.


, , ,
.

1. ,
MyExampleDB.dpr
2. Caption Form1
.
,
2: MyExUnitDB2.pas, MyExampleDB2.dpr.
2.
File|New Form. .
Caption .
MyUnitReport2.pas.
3. Form2 ,
. implementation
Form2 :
USES MyExUnitDB2
4. Form2 .
:
4.1 QReport Form2
QuickRep.
4, .
,
. ,
, 1 .
4.2 , Form2 .
DataSet
QuickRep1 Form1.Table1.

People.db.
5. . :
5.1. Form2 QReport QRBand ().

.
5.2. QReport QRBand1
QRLabel ( ).
5.3. QRLabel1 Caption
, Font
(Size), 16.
QRBand1.
6. ,
( , QReport):
6.1. QReport Form2 QRBand.
QRBand1.
BandType rbDetail, .
, .

6.2. QReport QRBand2


QRDBText ( ).
DataSet Form1.Table1,
DataField Family,Name,
SecName.
AutoSize False,
.
, 4 ,
, ,
QRBand2.
6.3. QRBand2 ,
QRDBText1, QRDBText2 QRDBText3
.
7. :
7.1. QReport Form2 QRSubDetail
( ). QRBand2.
DataSet Form1.Table2.

Tel.db. ,
Master, ,
QuickRep1.
7.2. QReport QRSubDetail1
QRDBText (
).
7.3. DataSet
Forme1.Table2, DataField
Number Type.
AutoSize False.
,
3 , , ,
QRSubDetail1.
7.4. QRSubDetail1 ,
QRDBText4 QRDBText5 .
8. : ,

. :
8.1. :
QRBand1 .
QReport QRSysData (
).
QRBand1. QRSysData1
Data qrsDate, Text .
QRSysData2 Data qrsTime,
Text .
AutoSize False,

.

8.2. QRShape
, QRSySData1
QRSysData2 ( ,
Edit|Send to back).
8.3. .
QReport Form2
QRBand. QRBand3.
BandType rbPageFooter. QReport
QRBand3
QRSysData. QRSysData3.
Data qrsPageNumber,
Text .
9. Form1
Form2. Form1,
implementation, :
USES MyUnitReport;
10. Form1 ,
. :
10.1. Standart
Form1 Button,
. Button2
Caption .
10.2.
OnClick :
procedure TForm1.Button2Click (Sender: TObject);
begin
Close;
end;
10.3. Button1 Caption
.
10.4.
OnClick :
procedure TForm1.Button1Click (Sender: TObject);
begin
Form2.QuickRep1.Preview;
end;
11. .
12. . .
QuickReport 2.0,
. QuickReport 2.0
Close. ,
.
. TQRPrinter

TQRPrinter TPersistent.
.

QuickRep. ,
QRPrinter, ,
, ,
.
, TQRPrinter,
QuickReport
2.0.

.
QuickRep,
Preview.
Preview
.
.


. .
TQRPrinter ,
, .


, ,
.
, . Delphi
Standart 3.0
Table, ,
.

:
File|New|Forms|QuickReport Labels
. ,
.
File|New|Forms|QuickReport List ,
.
, ,
.
File|New|Forms|QuickReport Master/Detail
. ,
, ,
,
.


.
,
. File|New|New|Report.
QuickReport.
Report Wizard
Report Wizard , ,
,
. , .
.
, Cancel,
( )
, <Back.
, Next>.

File|New|Bisuness|QuickReport Wizard.

3
1. , 2,
, :
1.
(, ),
.
2.
, (
).
3.

, .
4.
, , ,
.

5.
, ,
, .
, , .
6.
, ,
,
.
7.

, ,
, ,
.
8.
, ,
, , .
, ,
.
9.
, ,
.
10.
, ,
, , 5 .
.
11.
, , ,
. ,
,
.
12.
-,
,
, , .
.
13.
, ,
, ,
.
.
14.
, , ,
, .
15.
-, ,
, ,
,
.
16.
, ,
, ,
.
17.
, , , .

, ,
.
18.
, ,
, .
.
19.
, , ,
, , ,
.
20.
, ,
, .
,
, .
21.
, , ,
, , ,
, ,
.
22.
, ,
, , ,
.
.
23.
,
, , ,
.
24.
,
-,
.
.

.

.
.
, , ,

.
QBE SQL. SQL
, Delphi
.
SQL-
SQL :
;
;
;
.
SQL-, DBD,
sql.
SQL ,
.
, .
,
,
. ,
, , , ..
.
1. .
,

. :
SELECT [DISTINCT] < >
FROM < >
[WHERE < >]
[ORDER BY < >]
[GROUP BY < >]
[HAVING < >]
[UNION < >]
.
DESTINCT ,
.
< >:
[<>.]<>[AS
<>]{,[<>.]<>[AS
<>]}, ,
, ; ;
; AS ,
.
, *
.
< >:

<

>
[<>]{,<

>[<>]}.
WHERE ,
.
< >:
, :
[(<M.1>
<>
<N.2>)]{AND|OR
(<I.1> <> <J.2>)}, M, N,
I, J ; 1, 2
,
;
, : , , ,
; ,
AND
OR. , ,
.
:
[[<>.]<>
<>
<>]
{AND|OR
[<>.]<> <> <>}.
,
, IN, LIKE .
ORDER BY ,
.
< >:
[<>.]<> [ASC|DESC] {,[< >.]<> [ASC|DESC]},
ASC ( ) DESC
.
GROUP BY ,
.
< >:
[<>.]<> {,[<>.]<>}.
2. .

. :
INSERT INTO < > (<>{,<>})
VALUES (<>{,<>}).
:
, ;
;
, .
VALUES - ,
;
, (
).
3. .

,
. :
UPDATE < >
SET <> = <>{, <> = <>}
[WHERE < >]
:
SET , ,
; <> = <>{, <> =
<>} , .
[WHERE < >] ,
, .
4. .
,
. :
DELETE FROM < >
[WHERE < >].
(Query)
Table
. ,
,
Table. Query TQuery,
TDBDataSet.
SQL. , ;

. SQL.
, Delphi SQL
Query :
1) Query, DataSource ;
2) TQuery DataBaseName;
3) SQL SQL;
3) Active True.
BDE
, .
Delphi SQL- ,
, (
). SQL- ,
,
. ,

.
, , ,
,

<>, ,
.
TQuery ,
TDataSet, TBDEDataSet
TDBDataSet:
Local (True ,
False SQL-); .
RequestLive (
False), ,
. ,
True, ,
.

. CanModify
, ,
SQL, SQL Update.
SQL TStrings, SQL-,
Open ExecSQL.
UniDirectional
, .
UpdateMode TUpdateMode,
.
TQuery
SQL-. :
DataSource TDataSource, ,

.
Params[Index] TParams,
TParams, .

.
, .
TQuery TDataSet,
TBDEDataSet TDBDataSet ( ):
ExecSQL SQL-.
Prepare BDE
. .
, TQuery,
TDataSet.

Params
:
1) , ;
2) TQuery Prepare;
3) Params ;

4) .
1. , ,
,


, .
.
1. , 2.
Caption ().
,
, 5 :
MyExUnitDB5.pas, MyExampleDB5.dpr.
2. DataAccess Form1 Query
().
Query1, SQL
,
SQL:
SELECT D.*, D1.*
FROM < >\People.db D, < >\Tel.db D1
WHERE
(D.IDPeople = D1.IDPeople) AND (D.Family Like :FirstChar).
Like ,
FirstChar Family. Params
Form1.Query1 Parameters
. Parameter Name (
) FirstChar, DataType ( )
String Value () % - .
.
3. Active RequestLive Query1
True, .
4. DataAccess Form1
DataSource.
DataSet Query1.
5. Form1. DBGrid1
Standart Label.
Caption Label6 ,
Caption Label7 .
6. , Label6 Label7, Standart
Button. Caption .
,

.
OnClick
:
procedure TForm1.Button1Click(Sender: TObject);

begin
Form2.Visible := True;
end;
Visible
.
7. Form1 Additional
Bevel. Label6, Label7 Button1.
.
Style bsRaised ( ).
8. .
:
8.1. File|New Form.
8.2. Caption Form2
MyExUnitQuery.pas.
8.3. Form2 implementation
Form1:
USES MyExUnitDB5;
Form1.
Form2, implementation :
USES MyExUnitQuery;
8.4. ComboBox
Standart . Text A.
Items

, , , .
.
8.5. Standart
ComboBox1 Button.
Caption .
OnClick
,
Query1.
:
procedure TForm2.Button1ClickSender: TObject);
begin
WITH Form1.Query1 DO
BEGIN
Close;
Prepare;
Params[0].AsString := ComboBox1.Text + %;
Open;
END;
end;
9. Form2 Button,
Button1. Caption .

Form1
. Button2
OnClick :
procedure TForm2.Button2Click(Sender: TObject);
begin
Close;
end;
10.
DBGrid DataControls .
DataSourse Form1.DataSource3.
Editing DBGrid1.Columns ,
( ./. 2):
Family, Name, SecName, Number, Type,
Titel DBGrid1: , , ,
, .
11. Form1, ,
Button, Button2.
Caption ( ).
:
procedure TForm1.Button2Click(Sender: TObject);
begin
Close;
end;
12. Run|Run. ,
, ,
,
, DBGrid
.
13. .
14. .
TQuery
,
SQL:
Query1.Close;
Query1.SQL.Clear;
Close, .. ,
.
, , :
Query1.SQL.Add(Select * From People.db);
Add SQL
x .
, Delphi SQL
, :
Query1.Open;

,
ExecSQL. ExecSQL , ,
, .. Query1.Open
:
Query1.ExecSQL;
Query1.Refresh;
, Select
Open. Delete, Insert Update
ExecSQL.
,
.

2.

( )
, ,
.
: ,
, ,
,
. TQuery .
1. , .
Caption Form1 ( 2).
,
, 6 : MyExUnitDB6.pas,
MyExUnitQuery6.pas MyExampleDB6.dpr. Form1
implementation
USES MyExUnitQuery;

USES MyExUnitQuery6;
Form2
implementation
USES MyExUnitDB5;

USES MyExUnitDB6;
Caption .
Form1: Caption Label6
.
2. Form2. ComboBox1
Button1 ( ).
Standart
Button, DBGrid1 DataSource
, .

3. Button1 Caption .
OnClick
:
procedure TForm2.Button1Click(Sender: TObject);
begin
WITH Form1.Query1 DO
BEGIN
Close;
SQL.Clear;
SQL.Add('SELECT D.*, D1.*');
SQL.Add('FROM "People.db" D, "Tel.db" D1');
SQL.Add('WHERE');
SQL.Add('(D1.IDPeople = D.IDPeople)AND(D.Family < "")');
SQL.Add('ORDER BY D.Family ASC');
Open;
END;
Form1.DataSource3.DataSet := Form1.Query1;
DBGrid1.DataSource := Form1.DataSource3;
end;
4. Button3 Caption .
OnClick
:
procedure TForm2.Button3Click(Sender: TObject);
begin
WITH Form1.Query1 DO
BEGIN
Close;
SQL.Clear;
SQL.Add('SELECT D.*, D1.*');
SQL.Add('FROM "People.db" D, "Tel.db" D1');
SQL.Add('WHERE');
SQL.Add('(D1.IDPeople = D.IDPeople)AND(D.Family >= "")');
SQL.Add('ORDER BY D.Family ASC');
Open;
END;
Form1.DataSource3.DataSet := Form1.Query1;
DBGrid1.DataSource := Form1.DataSource3;
end;
5. Run|Run.
6. , .
, , .
7. .
8. .

4.

, 2,
:
1.
, ,
, , , .
2.
, , ,
, , , .
3.
, 0,5,
, , ,
.
4.
, ,
, , .
5.

.
6.

, .
7.
, ,
, , .
TQuery.
8.
,
, , .
9.
, .
10.
, ,
, , , .
11.
, ,
, ,
. TQuery.
12.
,
, , , -
.
13.

,
, 15,
.
14.
, ,
,
.
15.
, . TQuery.
16.
, - .
17.
, .
18.

, ,
, , .
19.
, ,
, , ,
.
20.
,
, .
21.
, , ,

TQuery.
22.
, ,
, , ,
.
23.
, ,
.
24.
, , , , .


,
. , ,

.
Delphi ,
TMenu. TMenuItem.
, ,
TMenuItem.
.
, OnClick
.
TMenuItem
, ,
.
, . ,
TmenuItem,
.
, ,
Items
. ( ),
, .
,
, Caption -.
.


.
.

. :
Break ,
.
Caption string, .
&,
.
Checked , ,
( True,
).
Default ; True,
,

OnClick.
False.
Enabled ; True,
(
).
GroupIndex , ,
.
.
Items[Index] - TMenuItem ( Index
),
. Count.
.
MenuIndex ,
Items .
RadioItem ;
True, , ..
.
ShortCut ,
,
.
ShortCut, ShortCutToKey, ShortCutToText,
TextToShortCut.
Visible ; True,
, False .
TMenuItem OnClick.
,
.
Add(Item) , Item ( TMenuItem)
.
Delete(Index) ,
Index.
.

() , ShortCut,

.
,
, .
,
(ShortCut, ShortCutToKey, ShortCutToText,
TextToShortCut).

Main Menu

.
Main Menu
Standart , Items.
(
).
. (,
) .

.
: NewItem, NewLine, NewSubMenu, NewMenu.
Popup Menu

, .
,
, .
, ,
.
.
TPopupMenu, ,
TMenu. , TPopupMenu
,
:
Alignment TPopupAlignment,
.
AutoPopup .
True, ,
False, (
Popup).
OnPopup ,
( AutoPopup
True) Popup. ,
.
Popup(X, Y) , ,
X Y.
,
. Popup Menu
Standart . Items
.

( ) PopupMenu
.

NewPopupMenu.

Items
NewItem, NewLine
NewSubMenu.


( ),
.

, .
Caption,
, .
.
- &,
. ,
.

, .
(
,
) ,
, Insert
.
, ,
.

Delete.
,
.

.

,
.
,
.
.
1. ,

,
, , , ,
: ,
, . ,

, , ,

.
,
People.db IDPeople, Family
Birthday .
1. DataBase Desktop 7.0
Family, Birthday IDPeople, FamilyIndex,
BirthdayIndex Number .
2. Delphi 3.0 ,
.
3. , ./. 2.
, ,
7: MyExampleDB7.dpr, MyExUnitDB7.pas.
4. .
:
4.1. ,
(
).
Color () clTeal ( ) ,
, .
4.2. ,
DBGrid1 (
./. 3 ./. 4).
5. .
:
5.1. Standart
Form1 MainMenu .
5.2. MainMenu1 Items
(), .
Caption ,
Name File_pt.
5.3. ,
, Caption
, Name Print_pt.
Caption -
. ,
Caption ,
Name Exit_pt.
5.4. (
) Caption
, Name Search-pt.
,
( Name Family1_pt
Date_pt ).

5.5. ,
( Name
Number_pt) ( Name Family2_pt).
5.6. . , Form1
,
.
6.
, ./. 3, ..
.
, :
6.1. MyUnitReport2.pas ./. 3
MyUnitReport.pas.
Form2 ( )
implementation
USES MyExUnitDB3;

USES MyExUnitDB7;
6.2. Form1 implementation
Form2:
USES MyUnitReport;
6.3. Form1
OnClick ,
:
procedure TForm1.Print-ptClick (Sender: TObject);
begin
Form2.QuickRep1.Preview;
end;
7.
:
OnClick , :
procedure TForm1.Exit-ptClick (Sender: TObject);
begin
Close;
end;
8.
,
, .
:
8.1. . ,

( ).
Caption .
Search7.pas.
8.2. Standart , ,
Label. Caption

, Font
.
8.3. Label1
Standart Edit
(
).
Text .
8.4. , Label1 Edit1,
BitBtn Additional
.
: Caption , Kind bkOK, ModalResult mrOK Name
OKBtn. .

: Caption , Kind bkCancel, ModalResult mrCancel
Name CancelBtn, .. Cancel.
8.5. .
Search7-1.pas. Caption
. , Form3,
: Caption Label1
,
Label Caption
.
8.6. Form1 Form3 Form4,
Form1, implementation
:
USES MyUnitReport, Search7, Search7-1;
9.

OnClick :
procedure TForm1.Family1-ptClick (Sender: TObject);
begin
IF Form3.ShowModal = mrCancel THEN Exit;
Form1.Table1.IndexName := FamilyIndex;
Form1.Table1.SetKey;
Form1.Table1.FieldByName(Family).AsString := Form3.Edit1.Text;
Form1.Table1.GotoNearest;
end;
(Form3)
( ShowModal). , ,
,
. ,
.
, , ..
. ,
.

SetKey
Family. GotoNearest
, ..
,
.
10.
, .
OnClick :
procedure TForm1.Date-ptClick (Sender: TObject);
begin
IF Form4.ShowModal = mrCancel THEN Exit;
Form1.Table1.IndexName := BirthdayIndex;
Form1.Table1.SetKey;
Form1.Table1.FieldByName(Birthday).AsString := Form4.Edit1.Text;
Form1.Table1.GotoNearest;
end;
11.
OnClick :
procedure TForm1.Number-ptClick (Sender: TObject);
begin
Form1.Table1.IndexName := Number;
Form1.Table1.SetKey;
Form1.Table1.GotoNearest;
end;
12. ,
,
OnClick :
procedure TForm1.Family2-ptClick (Sender: TObject);
begin
Form1.Table1.IndexName := FamilyIndex;
Form1.Table1.SetKey;
Form1.Table1.FieldByName(Family).AsString := A;
Form1.Table1.GotoNearest;
end;

, Family
A.
13. Run|Run
.
14. ,
|.
15. .

5
1. , 2,
,
(
):
1. .
2. , 3, (
).
:
1.
1. .
2.
3. .
4. .
5. (
).
6. ( ).
2.
1. .
2. .
3. .
4. .
5. .
6. , (
).
3.
1. .
2. .
3. .
4. (
).
5. .
6. ,
.
4.
1. .
2. .
3. .
4. .
5. .
6. .
5.
1. .
2. .

3. .
4. .
5. ,
.
6. , (
).
6.
1. .
2. .
3. .
4. .
5. (
).
6. ,
.
7.
1. .
2. .
3. .
4. .
5. , .
6. .
8.
1. .
2. .
3. .
4. .
5. , ,
.
6. .
9.
1. .
2. .
3. .
4. , .
5. , (
).
6. , (
).
10.
1. .
2. .
3. .
4. .
5. ( ).

6. , .
11.
1. .
2. .
3. .
4. .
5. ,
( ).
6. , .
12.
1. .
2. .
3. .
4. .
5. .
6. ( ),
.
13.
1. .
2. .
3. .
4. .
5. ,
.
6. (
).
14.
1. .
2. .
3. .
4. .
5. ,
( ).
6. , ,
.
15.
1. .
2. -.
3. .
4. .
5. -
( ).
6. .
16.

1.
2.
3.
4.
5.
6.

.
.
.
.
.
-, - (
).
17.
1. .
2. .
3. .
4. .
5. , - .
6. .
18.
1. .
2. .
3. .
4.
( ).
5. , .
6. .
19.
1. .
2. .
3. .
4. .
5. (
).
6. , ,
(
).
20.
1. .
2. .
3. .
4. ,
.
5. (, , ).
6. (
).
21.
1. .

2.
3.
4.
5.

.

.

.
6. , .
22.
1. .
2. .
3. .
4. .
5. .
6. (
).
23.
1. .
2. .
3. .
4. .
5. (
).
6. , .
24.
1. .
2. .
3. .
4. .
5. .
6. ,
( ).

6


,
.

:
;
RTF (Rich Text Format);
( );

;
;
,
- .
,
Windows 95,
Winhlp32 Winhlp32.exe.

,
.
1.
,
Word
for Windows 95.
1. , .
Tools|Options (|),
Options () View ()
Nonprinting Characters (
) HiddenText ( ).
.
2. ,
,
:
,

: , , ,
; .
MainWin (
) ,
View.

Navigator Menu.
.
,
.
.
,
.
,
Color () .
.
3. .
,
Insert|Footnote (|). Footnote

and Endnote () Insert ( )


Footnote (). Numbering ()
Custom Mark (),
# .
#
( ), .

MainTopic.
4. ,
. , .2,
, ,
Custom Mark () Footnote and Endnote (),
- $, - ,
.
5. ,
. , .3,
, K (),

;;;.
6. .
Insert|Break
(|). Page
Break ( ) .
7. ,
.

,

View. ,
Navigator Menu,
, , Close
.
.
.2.
8. .3-5,
MainWin, ,
; ; ; ;
.
9. ,
, .5.
10. ,
:

, ,
: People.db , Tel.db

,
: Edit, Grid.
.
.2.
11. .3-5,
View, ,
; ;.
12. ,
, .6.
13. ,
:

View /

:
:
: : 012; : 12.
:
,
;
.
: .
: .
:
: 15 1979 .; :
15.04.1979 15.04.79.
:
.

/
.

SeekFamily SeekDate
.
.
.2.
14. .3-5,
Edit, ,
;; ; .

, .
, .3, ,
, Custom
Mark () Footnote and Endnote (), -+,
View:005.

15. ,
, .6.
16. , :
.
View /
.
: . 232-00-00.

.
.
.2.
17. ,
Grid, , ;
; ,
View:010.
18. ,
, .6.
19. ,
, Navigator,

;;. :
.
MainWin ,
( , ):
First record - ;
Prior record - ;
Next record - ;
Last record - ;
Insert record - ;
Delete record - ;
Edit record - ;
Post edit - ;
Cancel edit - ;
Refresh data - .

.
.
,
,
Edit .

.
:
,


.
20. , ,
Menu, ,
;.
:
.
MainWin,
.
:
File.
Seek .
Sort
.
21. ,
,
Close, ,
;. :

:
MainWin
|File.
22. ,
, File,
, ;;
;;,
Menu:005. :
.
Menu :
Print.
Close.
23. ,
, Print,
, ;;;
. :
.
Menu
. |
,
, , ,
.
(
):
Zoom to fit ;

Zoom to 100% - ,
;
Zoom to page width ,
;
First Page ;
Previous Page ;
Next Page ;
Last Page ;
Printer Setup ;
Print ;
Save .qrp;
Load .qrp;
Close .
24. ,
, Seek,
, ;;
; ; ,
Menu:010.
:
.
Menu
- , ,
SeekFamily SeekDate.
25. ,
,
SeekFamily, ,
;; ; .
:
.
Menu |
,
.
,
, .
.
MainWin
View .
:
OKButtonOK ButtonCancel.
. Edit
26. ,
,
SeekDate, ,
;; ; ,
:

.
Menu |
,

.
MainWin
View .
: OKButtonOK
ButtonCancel.
. Edit.
27. ,
OK, ButtonOK,
, ;; .
:
OK.
Seek.

.
28. ,
, ButtonCancel,
, ;; .
:
.
Seek.
, .
29. ,
, Sort,
,
;;

; ,
Menu:020. :
.
Menu
- , ,
SortNDetal SortFamily .
30. ,
,
SortNDetal, ,
;; ; .
:
.

Menu |
,
MainWin View .
31. ,
,
SortFamily, ,
;; ; .
:
.
Menu |
,
MainWin
View .
32.
Help.rtf.
2. ,


.

Microsoft Help Workshop. Delphi
Standard 3.0
. \Delphi
3\Help\Tools. , hcw.exe,
.
1.
File|New. New
Help Contents .
.
2. , .
Edit
. Default Help Information
Default Help filename Help.hlp,
. Default
filename (and window) .
3. , Winhlp32.
Edit Default Help
Information Default Title
, .
Default title
.
4. .
Add Above. Edit Contents Tab Entry
Heading. Title (

)
.
5. ,
. Add Below.
Edit Contents Tab Entry Topic.
Title , , Topic ID
MainTopic .
6. .4
. , Title
.
7. .4
. ,
Move Right, .. (
).
8. .5
(Topic ID = Edit),
.
9.
(Topic ID = Grid).
10. ,
, ,
Move Left,
.
11. ,
(Topic ID)
File, Seek Sort , .
12.
(Topic ID = Navigator) (Topic ID = Close),
,
Move Left.
13. Help.cnt.
3.
, ,


. .
,
,
.
1. .
Microsoft Help Workshop. File|New.
New Help
Project .
Help ( .hpj).


.
:
[Option]
LCID=0x419 0x0 0x0 ;Russian
REPORT=Yes
LCID , REPORT
.
2. RTF,
. Files
Topic Files
Add, ,
Help.rtf Open. Topic
Files \Help.rtf. Topic Files,
.
,
[Files] .
3.
. Options
Options
Files. , Rich Text Format (RTF) files
RTF.
Browse Contents file
, Help.cnt.
Open, Options,
Contents file .\Help.cnt.
,
.
[Option]:
CNT=.\Help.cnt.
4. .
Map. Map
Add, Add Map Entry Topic ID
MainTopic, Mapped numbering value 1.
. Map
MainTopic=1
Comment Add
Map Entry.
Add Map Entry
,
( Mapped numbering
value *.rtf-).
Map.

[Map]
.
5.
, .. << >>.
Config .
Configuration macros Add Add Macro
Macro BrowseButtons(),
. Configuration macros .

[Config] :
BrowseButtons()
6. , ,
, .
Options ,
Fonts ().
Character Set ( ) RUSSIAN.
, Winhlp32,
Change () Font in Winhelp
Dialog Boxes ( Winhlp), Font ()
Font MS Sans Serif, Point
size ( ) 8,
Character Set RUSSIAN .
,
Add, Substitute these fonts in help topics
( ). Edit/Add
font Mapping (/ ) Original Font
( ) , ..
, Replacement font (
) Font MS Sans Serif
Windows . Options
. [Option]
:
DEFFONT = MS Sans Serif, 8, 204
[Fonts],
:
=MS Sans Serif
7. ,
Save and Compile.
Help Workshop ,
.
.
1. , ./. 5, MyExampleDB7.dpr.

2. MyExampleDB7.dpr.
Project|View Source.

Application.Initialize;

Application.HelpFile := < >\Help.hlp;
3. HelpContext
( ) 2.
4. , ,
DBEdit1 HelpContext

5. HelpContext
Form1 (
)
6. Form3 HelpContext
12, Edit1, OKBtn
CancelBtn 4, 14 15 .
7. Form4 HelpContext 13,
HelpContext Edit1, OKBtn CancelBtn 4, 14
15 .
8. Form1 , ,
BitBtn Additional .
Caption . Kind
bkHelp, DragCursor crHelp,
Layout blGlyphRight ( ),
HelpContext 1,
, , .
.

6
1. ,
5.
2.
.


1. . Delphi 2 : :
. .- .: VH--,1997.-784 .

2... Delphi 3.-.:


,1998.-288 .
3. .. Pascal 7.0
Delphi: ()-.: VH--,1999.-234 .
4
.

.
.,

..
Delphi: .-.:
.,1997.- 4. .

.-1998.-400 .
5. .. Delphi 5: .-: :
-,2000.-638 .
6. .. 100
Delphi 5.-.: ,1999.-266 .
7. . ., .. Delphi5.
.-: -, 2000.-416 .


DELPHI



..

60x84/16.
. ...0,00. .-..0,00.
50 . .

, 432027,,.,32.
,432027,,.,32.