Ïðîåêòóâàííÿ äâîëàíêîâî¿ ðîçïîä³ëåíî¿ ³íôîðìàö³éíî¿ ñèñòåìè äëÿ ðîáîòè ç áàçàìè äàíèõ ³ç âèêîðèñòàííÿì SQL Interbase

68745
çíàêîâ
0
òàáëèö
21
èçîáðàæåíèå

Ïðîåêòóâàííÿ äâîëàíêîâî¿ ðîçïîä³ëåíî¿ ³íôîðìàö³éíî¿ ñèñòåìè äëÿ ðîáîòè ç ÁÄ ³ç âèêîðèñòàííÿì SQL Interbase

Ìåòà:

• ñòâîðåííÿ ÁÄ;

• ñòâîðåííÿ ³ âèêîðèñòàííÿ ³íäåêñ³â òà ïåðåãëÿä³â ÁÄ;

• ñòâîðåííÿ ³ âèêîðèñòàííÿ òðèãåð³â, ãåíåðàòîð³â òà çáåðåæåíèõ ïðîöåäóð íà áîö³ SQL-ñåðâåðà;

• îòðèìàííÿ ïðàêòè÷íèõ íàâè÷îê îáì³íó äàíèìè ì³æ ïðèêëàäåííÿì ³ ÁÄ.

Çàâäàííÿ:

Çàñîáàìè SQL Interbase íåîáõ³äíî ñòâîðèòè ÁÄ, äåê³ëüêà ³íäåêñîâàíèõ òàáëèöü ÁÄ (ãîëîâíó ³ ï³äëåãë³) ³ äåê³ëüêà ¿õ ïåðåãëÿä³â, à òàêîæ çâ’ÿçàòè ¿õ ì³æ ñîáîþ.

Çàñîáàìè Ñ++Builder ñòâîðèòè îðèã³íàëüíå(!) ïðèêëàäåííÿ, ÿêå ïîâèííå íàäàâàòè ìîæ-ëèâ³ñòü:

• ïåðåãëÿäó çàïèñ³â çâ’ÿçàíèõ òàáëèöü ÁÄ, ó òîìó ÷èñë³ ïîïåðåäí³õ ³ íàñòóïíèõ çàïèñ³â òà ³ç âèêîðèñòàííÿì ñòâîðåíèõ ïåðåãëÿä³â;

• ô³ëüòðàö³¿ çàïèñ³â ÁÄ ³ç âèâåäåííÿì íà åêðàí çàïèñ³â, îáðàíèõ ó ä³àëîç³ çà âêàçàíèìè êðèòåð³ÿìè;

• ³íêðåìåíòàëüíîãî ïîøóêó äàíèõ ó ÁÄ çà âêàçàíèìè êðèòåð³ÿìè;

• äîäàâàííÿ ³ âèäàëåííÿ çàïèñè òàáëèö³ ÁÄ, ó òîìó ÷èñë³ ³ç âèêîðèñòàííÿì ñòâîðåíèõ íà áîö³ SQL-ñåðâåðà òðèãåð³â, ãåíåðàòîð³â òà çáåðåæåíèõ ïðîöåäóð;

• êîðåãóâàííÿ ïîë³â ïîòî÷íîãî çàïèñó òàáëèö³ ÁÄ, ó òîìó ÷èñë³ ³ç âèêîðèñòàííÿì ñòâîðå-íî¿ íà áîö³ SQL-ñåðâåðà çáåðåæåíî¿ ïðîöåäóðè.

Âêàç³âêè äî ñòâîðåííÿ ÁÄ:

Äëÿ ñòâîðåííÿ ÁÄ ³ç âèêîðèñòàííÿì SQL Interbase íåîáõ³äíî:

• çàâàíòàæèòè íà âèêîíàííÿ ïðèêëàäåííÿ InterBase Windows ISQL, ÿêå çà çâè÷àé çáåð³ãàº-òüñÿ çà ìàðøðóòîì "<äèñê>:\Program Files\InterBase Corp\ InterBase\ Bin\wisql32.exe", íàïðèêëàä, “E:\Program Files\InterBase Corp\ InterBase\ Bin\wisql32.exe";

• âèêîíàòè êîìàíäó File | Create Database … ³ ó â³êîíö³, ÿêå ç’ÿâèëîñÿ (ìàë. 1.1), âêàçàòè íàâåäåí³ ïàðàìåòðè (ïàðàìåòðè ìîæóòü áóòè äîâ³ëüíèìè);

• âèêîíàòè êîìàíäó Metadata | Show … ³ ó â³êîíö³, ÿêå ç’ÿâèëîñÿ (ìàë. 1.2), ó ïîë³ View Information On: îáðàòè ç ìåíþ àëüòåðíàòèâó Database. ßêùî ÁÄ áóëî óñï³øíî ñòâîðåíî, òî ó â³êí³ InterBase Windows ISQL ç’ÿâèòüñÿ â³äïîâ³äíå ïîâ³äîìëåííÿ (ìàë. 1.3).

• âèêîíàòè êîìàíäó File | Commit Work äëÿ çáåðåæåííÿ ðåçóëüòàò³â ðîáîòè íà äèñêó;

• äàë³ (âæå çàñîáàìè Ñ++ Builder) êîìàíäîþ Database | Explore çàâàíòàæèòè íà âèêîíàííÿ ïðèêëàäåííÿ Database Explore, êîìàíäîþ Object | New | INTRBASE ñòâîðèòè àë³àñ dbP, îáðàòè éîãî íà âêëàäèíö³ Databases ³ âêàçàòè ïàðàìåòðè, ÿê³ íàâåäåíî íà ìàë. 1.4; ïîò³ì âèêîíàòè êîìàíäó Object | Apply äëÿ çáåðåæåííÿ çðîáëåíèõ çì³í;

• ó ïðèêëàäåíí³ InterBase Windows ISQL âèêîíàòè êîìàíäó File | Run an ISQL Script … ³ ó â³êí³, ùî ç’ÿâèëîñÿ (ìàë. 1.5), âêàçàòè ³ì’ÿ ôàéëó Createdb.sql, â ÿêîìó íàáðàíî ñêðèïò äëÿ ñòâîðåííÿ òàáëèöü ÁÄ;


 

Ìàëþíîê 1.1 Ìàëþíîê 1.2

Ìàëþíîê 1.3

Ìàëþíîê 1.4

 

Ìàëþíîê 1.5

Âì³ñò öüîãî ôàéëó íàâåäåíî íèæ÷å:

/* ç’ºäíàííÿ ç ÁÄ */

CONNECT "e:\Lr2\dbP\dbP.gdb" USER "SYSDBA" PASSWORD "masterkey";

/* ñòâîðåííÿ òàáëèö³ PERS */

create table pers(

 Num smallint Not Null Primary Key,

 Dep char(15),

 Fam char(20) Not Null,

 Nam char(20) Not Null,

 Par char(20) Not Null,

 Year_b smallint,

 Sex char(1),

 Charact blob,

 Photo blob

);

/* ñòâîðåííÿ òàáëèö³ DEP */

create table dep(

 Dep char(15) Not Null Primary Key,

 Proisv char(15)

);

/* çàïîâíåííÿ òàáëèö³ PERS */

Insert Into PERS(Num, Dep, Fam, Nam, Par, Year_b, Sex)

 Values(1, "Áóõãàëòåð³ÿ", "²âàíîâ", "²âàí", "²âàíîâè÷", 1950, "÷");

Insert Into PERS(Num, Dep, Fam, Nam, Par, Year_b, Sex)

 Values(2, "Öåõ 1", "Ïåòðîâ", "Ïåòðî", "Ïåòðîâè÷", 1960, "÷");

Insert Into PERS(Num, Dep, Fam, Nam, Par, Year_b, Sex)

 Values(3, "Öåõ 2", "Ñèäîðîâ", "Ñèäîð", "Ñèäîðîâè÷", 1955, "÷");

Insert Into PERS(Num, Dep, Fam, Nam, Par, Year_b, Sex)

 Values(4, "Öåõ 1", "²âàíîâà", "²ðèíà", "²âàí³âíà", 1971, "æ");

Insert Into PERS(Num, Dep, Fam, Nam, Par, Year_b, Sex)

 Values(5, "Áóõãàëòåð³ÿ", "Ìèêîëàºâ", "Ìèêîëà", “Ìèêîëàéîâè÷", 1930, "÷”);

Insert Into PERS(Num, Dep, Fam, Nam, Par, Year_b, Sex)

 Values(6, "Öåõ 2", "Àíäð³ºâ", "Àíäð³é", "Àíäð³éîâè÷", 1930, "÷");

Insert Into PERS(Num, Dep, Fam, Nam, Par, Year_b, Sex)

 Values(7, "Öåõ 1", "Áîðèñîâ", "Áîðèñ", "Áîðèñîâè÷", 1937, "÷");

Insert Into PERS(Num, Dep, Fam, Nam, Par, Year_b, Sex)

 Values(8, "Öåõ 1", "Ïàâëîâ", "Ïàâëî", "Ïàâëîâè÷", 1975, "÷");

Insert Into PERS(Num, Dep, Fam, Nam, Par, Year_b, Sex)

 Values(9, "Áóõãàëòåð³ÿ", "Àíòîíîâà", "Àíòîí³íà", "Àíòîí³âíà", 1965, "æ");

Insert Into PERS(Num, Dep, Fam, Nam, Par, Year_b, Sex)

 Values(10, "Öåõ 2", "Õàðèòîíîâ", "Õàðèòîí", "Õàðèòîíîâè÷", 1962, "÷");

Insert Into PERS(Num, Dep, Fam, Nam, Par, Year_b, Sex)

 Values(11, "Öåõ 2", "²âàííèêîâ", "²âàí", "²âàíîâè÷", 1975, "÷");

/* çàïîâíåííÿ òàáëèö³ DEP */

Insert Into DEP( Dep,Proisv) Values("Áóõãàëòåð³ÿ", "óïðàâë³ííÿ");

Insert Into DEP( Dep,Proisv) Values("Öåõ 1", "âèðîáíèöòâî");

Insert Into DEP( Dep,Proisv) Values("Öåõ 2", "âèðîáíèöòâî");

Commit;

ϳñëÿ íàòèñêàííÿ êíîïêè Îòêðûòü òðåáà âêàçàòè, ùî ðåçóëüòàòè âèêîíàííÿ ñêðèïòó íåîáõ³äíî çáåð³ãàòè ó ôàéë³ Result.txt. Ñêðèïò âèêîíóºòüñÿ.

Îãëÿíóòè ñõåìó ñòâîðåíî¿ òàáëèö³ (íàïðèêëàä, òàáëèö³ PERS) ìîæíà êîìàíäîþ Meta-data | Show … (ìàë. 1.6)

 Ìàëþíîê 1.6

SHOW TABLE PERS

NUM SMALLINT Not Null

DEP CHAR(15) Nullable

FAM CHAR(20) Not Null

NAM CHAR(20) Not Null

PAR CHAR(20) Not Null

YEAR_B SMALLINT Nullable

SEX CHAR(1) Nullable

CHARACT BLOB segment 80, subtype UNKNOWN Nullable

PHOTO BLOB segment 80, subtype UNKNOWN Nullable

CONSTRAINT INTEG_2:

 Primary key (NUM)

Îãëÿíóòè âì³ñò ñòâîðåíî¿ òàáëèö³ (íàïðèêëàä, òàáëèö³ PERS) ìîæíà íàáîðîì çàïèòó Select * from PERS ó â³êí³ InterBase Windows ISQL, àáî æ çà äîïîìîãîþ Database Explore (ìàë. 1.7):

 

Ìàëþíîê 1.7

• ñòâîðèòè ³íäåêñè òàáëèö³ PERS, äëÿ ÷îãî âèêîíàòè ñêðèïò, ùî ì³ñòèòüñÿ ó ôàéë³ CreateINDEXESdbP.sql:

/* Ç'ºäíàííÿ ç ÁÄ */

CONNECT "e:\Lr3\dbP\dbP.gdb" USER "SYSDBA" PASSWORD "masterkey";

/* Ñòâîðåííÿ ³íäåêñ³â */

create index Person On PERS Fam,Nam,Par;

create index DepPerson On PERS Dep,Fam,Nam,Par;

create index Year On PERS Year_b;

• ñòâîðèòè ïåðåãëÿäè òàáëèö³ PERS, äëÿ ÷îãî âèêîíàòè ñêðèïò, ùî ì³ñòèòüñÿ ó ôàéë³ CreateVIEWSdbP.sql:

/* Ç'ºäíàííÿ ç ÁÄ */

CONNECT "e:\Lr3\dbP\dbP.gdb" USER "SYSDBA" PASSWORD "masterkey";

/* Ñòâîðåííÿ ïåðåãëÿä³â òàáëèö³ PERS çà ï³äðîçä³ëàìè */

Create VIEW dep_1 as

 select Dep, Num, Fam, Nam, Par, Year_b, Sex from Pers

 where Dep = "Áóõãàëòåð³ÿ";

Create VIEW dep_2 as

 select Dep, Num, Fam, Nam, Par, Year_b, Sex from Pers

 where Dep = "Öåõ 1";

Create VIEW dep_3 as

 select Dep, Num, Fam, Nam, Par, Year_b, Sex from Pers

 where Dep = "Öåõ 2";

• äàë³ çàñîáàìè Ñ++ Builder êîìàíäîþ Database | Explore çàâàíòàæèòè íà âèêîíàííÿ ïðèêëàäåííÿ Database Explore ³ ç éîãî äîïîìîãîþ ñòâîðèòè ãåíåðàòîð PERSGEN, ÿê ïîêàçàíî íà ìàë. 1.8;

Ìàëþíîê 1.8

• ñòâîðèòè òðèããåð PERSSWITCH òàáëèö³ PERS, äëÿ ÷îãî âèêîíàòè ñêðèïò, ùî ì³ñòè-òüñÿ ó ôàéë³ CreateTRIGGERdbP.sql:

CONNECT "e:\Lr3\dbP\dbP.gdb" USER "SYSDBA" PASSWORD "masterkey";

/* Ñòâîðåííÿ òðèããåðà PERSSWITCH äëÿ çá³ëüøåííÿ íîìåðà çàïèñó ï³ä ÷àñ âñòàâêè çàïèñó ó òàáëèöþ */

SET TERM ^;

CREATE TRIGGER PERSSWITCH FOR PERS

 BEFORE INSERT AS

 BEGIN

 NEW.NUM = GEN_ID(PERSGEN, 1);

 END;^

SET TERM ;^

COMMIT;

• ñòâîðèòè íà áîö³ SQL-ñåðâåðà âèêîíóºì³ ïðîöåäóðè âñòàâêè (INSERTdbP), âèäàëåííÿ (DELETEdbP) òà êîðåãóâàííÿ (UPDATEdbP) òàáëèö³ PERS, äëÿ ÷îãî:

• âèêîíàòè ñêðèïò, ùî ì³ñòèòüñÿ ó ôàéë³ CreateProcINSERTdbP.sql:

CONNECT "e:\Lr3\dbP\dbP.gdb" USER "SYSDBA" PASSWORD "masterkey";

/* Âèêîíóºìà ïðîöåäóðà INSERTdbP. Äîäຠäàí³ ïðî ñï³âðîá³òíèêà, âåðòຠíîìåð çàïèñó */

SET TERM ^;

CREATE PROCEDURE INSERTdbP

 (

 pDEP CHAR(15),

 pFAM CHAR(20),

 pNAM CHAR(20),

 pPAR CHAR(20),

 pYEAR_B INTEGER,

 pSEX CHAR(1)

 )

AS

 BEGIN

 Insert into PERS (DEP, FAM, NAM, PAR, YEAR_B, SEX)

 VALUES (:pDEP, :pFAM, :pNAM, :pPAR, :pYEAR_B, :pSEX);

 END;^

SET TERM ;^

COMMIT;

• âèêîíàòè ñêðèïò, ùî ì³ñòèòüñÿ ó ôàéë³ CreateProcDELETEdbP.sql:

CONNECT "e:\Lr3\dbP\dbP.gdb" USER "SYSDBA" PASSWORD "masterkey";

/* Âèêîíóºìà ïðîöåäóðà DELETEdbP çíèùåííÿ äàíèõ ïðî ñï³âðîá³òíèêà */

SET TERM ^;

CREATE PROCEDURE DELETEdbP

 (

 pNUM INTEGER

 )

AS

 BEGIN

 DELETE FROM PERS WHERE NUM = :pNUM;

 END;^

SET TERM ;^

COMMIT;

• âèêîíàòè ñêðèïò, ùî ì³ñòèòüñÿ ó ôàéë³ CreateProcUPDATEdbP.sql:

CONNECT "e:\Lr3\dbP\dbP.gdb" USER "SYSDBA" PASSWORD "masterkey";

/* Âèêîíóºìà ïðîöåäóðà UPDATEdbP.

 Çì³íþº äàí³ ïðî ñï³âðîá³òíèêà, âåðòຠíîìåð çàïèñó ÷è 0, ÿêùî ñï³âðîá³òíèêà íåìà */

SET TERM ^;

CREATE PROCEDURE UPDATEdbP

 (

 pDEP CHAR(15),

 pFAM CHAR(20),

 pNAM CHAR(20),

 pPAR CHAR(20),

 pYEAR_B INTEGER,

 pSEX CHAR(1)

 )

 RETURNS

 (number integer)

AS

 BEGIN

 number = 0;

 Select NUM From PERS

 Where (FAM = :pFAM) and (NAM = :pNAM) and (PAR = :pPAR)

 Into number;

 if (number > 0) then

 Update PERS Set DEP = :pDEP, YEAR_B = :pYEAR_B, SEX = :pSEX

 Where (FAM = :pFAM) and (NAM = :pNAM) and (PAR = :pPAR);

 END;^

SET TERM ;^

COMMIT;

Ó ðåçóëüòàò³ âèêîíàííÿ öèõ ä³é áóäå ñòâîðåíî ÁÄ ç³ ñòðóêòóðîþ, ùî íàâåäåíî íà ìàë. 1.10.

 

Ìàëþíîê 1.10

Âêàç³âêè äî ñòâîðåííÿ ïåðøîãî ïðèêëàäåííÿ:

Äëÿ ìàí³ïóëþâàííÿ òàáëèöÿìè òðåáà ñòâîðèòè ïðîåêò ïðèêëàäåííÿ (ìàë. 1.11).

 Ìàëþíîê 1.11

Ãîëîâíó ôîðìó main_Form íàâåäåíî íà ìàë. 1.12 ³ ìàë. 1.13.

Ìàëþíîê 1.12

Ìàëþíîê 1.13

Òåêñòîâèé îïèñ ôîðìè main_Form:

object main_Form: Tmain_Form

 Left = 147

 Top = 103

 Width = 709

 Height = 460

 Caption = 'Ëàáîðàòîðíà ðîáîòà 2'

 Color = clBtnFace

 Font.Charset = DEFAULT_CHARSET

 Font.Color = clWindowText

 Font.Height = -11

 Font.Name = 'System'

 Font.Style = [fsBold]

 OldCreateOrder = True

 Position = poScreenCenter

 OnCreate = FormCreate

 PixelsPerInch = 96

 TextHeight = 16

 object PageControl: TPageControl

 Left = 421

 Top = 0

 Width = 280

 Height = 428

 ActivePage = find_TabSheet

 Align = alClient

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clWindowText

 Font.Height = -13

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 MultiLine = True

 ParentFont = False

 TabOrder = 0

 OnChange = PageControlChange

 object find_TabSheet: TTabSheet

 Caption = '³äá³ð'

 object select_GroupBox: TGroupBox

 Left = 1

 Top = 5

 Width = 268

 Height = 212

 Caption = '³äá³ð çà ...'

 TabOrder = 7

 end

 object sex_RadioGroup: TRadioGroup

 Left = 8

 Top = 120

 Width = 257

 Height = 53

 Caption = ' ñòàòòþ '

 Columns = 2

 ItemIndex = 0

 Items.Strings = (

 '÷îëîâ³÷à'

 'æ³íî÷à')

 TabOrder = 0

 OnClick = minage_CSpinEditChange

 end

 object speedfind_GroupBox: TGroupBox

 Left = 0

 Top = 224

 Width = 257

 Height = 169

 Caption = ' Øâèäêèé ïîøóê çà ïð³çâèùåì '

 TabOrder = 5

 object Image1: TImage

 Left = 8

 Top = 16

 Width = 105

 Height = 145

 Picture.Data = { }

 Stretch = True

 end

 object speedfind_Label: TLabel

 Left = 154

 Top = 42

 Width = 56

 Height = 16

 Caption = 'Ïð³çâèùå'

 end

 object speedfind_Image: TImage

 Left = 32

 Top = 48

 Width = 57

 Height = 73

 Picture.Data = { }

 Stretch = True

 end

 end

 object age_GroupBox: TGroupBox

 Left = 8

 Top = 32

 Width = 257

 Height = 81

 Caption = ' â³êîì '

 Enabled = False

 TabOrder = 4

 object minage_Label: TLabel

 Left = 65

 Top = 15

 Width = 28

 Height = 16

 Caption = 'â³ä ...'

 end

 object maxage_Label: TLabel

 Left = 192

 Top = 15

 Width = 25

 Height = 16

 Caption = 'äî ...'

 end

 object minage_Image: TImage

 Left = 8

 Top = 24

 Width = 41

 Height = 49

 Picture.Data = { }

 Stretch = True

 Transparent = True

 end

 object maxage_Image: TImage

 Left = 136

 Top = 24

 Width = 41

 Height = 49

 Picture.Data = { }

 Stretch = True

 Transparent = True

 end

 end

 object speedfind_Edit: TEdit

 Left = 120

 Top = 296

 Width = 129

 Height = 22

 Hint = 'Ââîä ôàìèëèè'

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clWindowText

 Font.Height = -11

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 ParentFont = False

 ParentShowHint = False

 ShowHint = True

 TabOrder = 1

 OnChange = speedfind_EditChange

 end

 object minage_CSpinEdit: TCSpinEdit

 Left = 62

 Top = 66

 Width = 65

 Height = 26

 TabStop = True

 MaxValue = 80

 MinValue = 16

 ParentColor = False

 TabOrder = 2

 Value = 16

 OnChange = minage_CSpinEditChange

 end

 object maxage_CSpinEdit: TCSpinEdit

 Left = 190

 Top = 66

 Width = 65

 Height = 26

 TabStop = True

 MaxValue = 80

 MinValue = 16

 ParentColor = False

 TabOrder = 3

 Value = 30

 OnChange = minage_CSpinEditChange

 end

 object select_BitBtn: TBitBtn

 Left = 8

 Top = 184

 Width = 257

 Height = 25

 Cursor = crHandPoint

 Caption = 'Ïîíîâèòè â³äá³ð'

 TabOrder = 6

 OnClick = select_BitBtnClick

 Kind = bkOK

 end

 end

 object TabEdit: TTabSheet

 Caption = 'Êîðåãóâàííÿ'

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clBlack

 Font.Height = -13

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 ParentFont = False

 object ch_GroupBox: TGroupBox

 Left = 2

 Top = 5

 Width = 269

 Height = 388

 Caption = ' Çàãàëüí³ â³äîìîñò³ '

 TabOrder = 9

 object chdp_Label: TLabel

 Left = 12

 Top = 38

 Width = 50

 Height = 16

 Caption = '³ää³ëîê'

 FocusControl = chdp_ComboBox

 end

 object chname_Label: TLabel

 Left = 12

 Top = 138

 Width = 25

 Height = 16

 Caption = '²ì'#39'ÿ'

 FocusControl = chname_Edit

 end

 object chgrand_Label: TLabel

 Left = 12

 Top = 188

 Width = 73

 Height = 16

 Caption = 'Ïî áàòüêîâ³'

 FocusControl = chgrand_Edit

 end

 object chyear_Label: TLabel

 Left = 12

 Top = 232

 Width = 95

 Height = 16

 Caption = 'гê íàðîäæåííÿ'

 end

 object chfam_Label: TLabel

 Left = 12

 Top = 87

 Width = 56

 Height = 16

 Caption = 'Ïð³çâèùå'

 FocusControl = chfam_Edit

 end

 object oper_Bevel: TBevel

 Left = 18

 Top = 282

 Width = 251

 Height = 96

 end

 object oper_Shape: TShape

 Left = 19

 Top = 283

 Width = 248

 Height = 94

 Brush.Color = clBlack

 end

 object Animate1: TAnimate

 Left = 24

 Top = 291

 Width = 60

 Height = 80

 Active = True

 FileName = 'Frage.avi'

 StopFrame = 31

 Transparent = False

 end

 end

 object sex2_RadioGroup: TRadioGroup

 Left = 185

 Top = 218

 Width = 77

 Height = 41

 Caption = 'Ñòàòü'

 Columns = 2

 ItemIndex = 0

 Items.Strings = (

 '÷'

 'æ')

 TabOrder = 4

 end

 object chdp_ComboBox: TComboBox

 Left = 101

 Top = 40

 Width = 162

 Height = 22

 Style = csDropDownList

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clBlack

 Font.Height = -11

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 ItemHeight = 0

 ParentFont = False

 TabOrder = 0

 end

 object chfam_Edit: TEdit

 Left = 101

 Top = 90

 Width = 162

 Height = 22

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clBlack

 Font.Height = -11

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 ParentFont = False

 TabOrder = 1

 Text = 'chfam_Edit'

 end

 object chname_Edit: TEdit

 Left = 101

 Top = 140

 Width = 162

 Height = 22

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clBlack

 Font.Height = -11

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 ParentFont = False

 TabOrder = 2

 Text = 'chname_Edit'

 end

 object chgrand_Edit: TEdit

 Left = 101

 Top = 190

 Width = 162

 Height = 22

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clBlack

 Font.Height = -11

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 ParentFont = False

 TabOrder = 3

 Text = 'chgrand_Edit'

 end

 object chadd_Button: TButton

 Left = 88

 Top = 294

 Width = 169

 Height = 25

 Hint = 'Íîâàÿ çàïèñü'

 Caption = '&Äîäàòè'

 ParentShowHint = False

 ShowHint = True

 TabOrder = 5

 OnClick = chadd_ButtonClick

 end

 object chdelete_Button: TButton

 Left = 88

 Top = 322

 Width = 169

 Height = 25

 Hint = 'Óäàëåíèå çàïèñè'

 Caption = '&Âèäàëèòè'

 ParentShowHint = False

 ShowHint = True

 TabOrder = 6

 OnClick = chdelete_ButtonClick

 end

 object chpost_Button: TButton

 Left = 88

 Top = 351

 Width = 169

 Height = 25

 Hint = 'Ôèêñàöèÿ èçìåíåíèé'

 Caption = '&Ïîíîâèòè'

 ParentShowHint = False

 ShowHint = True

 TabOrder = 7

 OnClick = chpost_ButtonClick

 end

 object chyear_CSpinEdit: TCSpinEdit

 Left = 119

 Top = 233

 Width = 50

 Height = 23

 TabStop = True

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clBlack

 Font.Height = -11

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 MaxValue = 2000

 MinValue = 1900

 ParentColor = False

 ParentFont = False

 TabOrder = 8

 Value = 1950

 end

 end

 end

 object left_Panel: TPanel

 Left = 0

 Top = 0

 Width = 421

 Height = 428

 Align = alLeft

 BevelInner = bvLowered

 Caption = 'left_Panel'

 TabOrder = 1

 object find_TPanel: TPanel

 Left = 6

 Top = 5

 Width = 406

 Height = 420

 Caption = 'find_TPanel'

 TabOrder = 1

 object find_Label: TLabel

 Left = 110

 Top = 20

 Width = 265

 Height = 24

 Alignment = taCenter

 Caption = 'ÏÎØÓÊ ÑϲÂÐÎÁ²ÒÍÈʲÂ'

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clRed

 Font.Height = -21

 Font.Name = 'Arial Cyr'

 Font.Style = [fsBold, fsItalic]

 ParentFont = False

 end

 object dp_GroupBox: TGroupBox

 Left = 8

 Top = 56

 Width = 393

 Height = 57

 Caption = ' ³ää³ëîê '

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clWindowText

 Font.Height = -13

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 ParentFont = False

 TabOrder = 0

 object dp_ComboBox: TComboBox

 Left = 8

 Top = 24

 Width = 177

 Height = 24

 ItemHeight = 16

 Items.Strings = (

 'Áóõãàëòåðèÿ')

 TabOrder = 0

 OnChange = dp_ComboBoxChange

 end

 end

 object dp2_GroupBox: TGroupBox

 Left = 200

 Top = 66

 Width = 193

 Height = 41

 Caption = ' ï³äðîçä³ë '

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clWindowText

 Font.Height = -13

 Font.Name = 'Times New Roman'

 Font.Style = [fsItalic]

 ParentFont = False

 TabOrder = 1

 object dp2_DBEdit: TDBEdit

 Left = 5

 Top = 15

 Width = 182

 Height = 23

 Color = clSilver

 DataField = 'PROISV'

 DataSource = dp_DataSource

 Enabled = False

 TabOrder = 0

 end

 end

 object pr_GroupBox: TGroupBox

 Left = 8

 Top = 115

 Width = 393

 Height = 226

 Caption = ' Ñï³âðîá³òíèêè '

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clWindowText

 Font.Height = -13

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 ParentFont = False

 TabOrder = 2

 object Bevel1: TBevel

 Left = 10

 Top = 197

 Width = 41

 Height = 24

 end

 object pr_Label: TLabel

 Left = 16

 Top = 201

 Width = 29

 Height = 16

 Alignment = taCenter

 AutoSize = False

 end

 end

 object find_Animate: TAnimate

 Left = 32

 Top = 8

 Width = 48

 Height = 45

 Active = True

 CommonAVI = aviFindComputer

 StopFrame = 8

 end

 object GroupBox1: TGroupBox

 Left = 8

 Top = 340

 Width = 393

 Height = 77

 Caption = 'Ïîòî÷íèé îïåðàòîð SQL'

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clWindowText

 Font.Height = -13

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 ParentFont = False

 TabOrder = 4

 object sql_Label: TLabel

 Left = 11

 Top = 16

 Width = 372

 Height = 57

 AutoSize = False

 Color = clBtnFace

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clRed

 Font.Height = -13

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 ParentColor = False

 ParentFont = False

 WordWrap = True

 end

 end

 end

 object pr_DBGrid: TDBGrid

 Left = 22

 Top = 144

 Width = 379

 Height = 169

 DataSource = pr_DataSource

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clWindowText

 Font.Height = -11

 Font.Name = 'Times New Roman'

 Font.Style = [fsItalic]

 Options = [dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit]

 ParentFont = False

 TabOrder = 0

 TitleFont.Charset = RUSSIAN_CHARSET

 TitleFont.Color = clWindowText

 TitleFont.Height = -11

 TitleFont.Name = 'Times New Roman'

 TitleFont.Style = [fsItalic]

 OnCellClick = pr_DBGridCellClick

 Columns = <

 item

 Expanded = False

 FieldName = 'FAM'

 Title.Caption = 'Ïð³çâèùå'

 Width = 59

 Visible = True

 end

 item

 Expanded = False

 FieldName = 'NAM'

 Title.Caption = '³ì'#39'ÿ'

 Width = 57

 Visible = True

 end

 item

 Expanded = False

 FieldName = 'PAR'

 Title.Caption = 'ïî áàòüêîâ³'

 Width = 67

 Visible = True

 end

 item

 Alignment = taCenter

 Expanded = False

 FieldName = 'YEAR_B'

 Title.Caption = 'ð³ê íàðîäæåííÿ'

 Width = 85

 Visible = True

 end

 item

 Alignment = taCenter

 Expanded = False

 FieldName = 'SEX'

 Title.Caption = 'ñòàòü'

 Visible = True

 end

 item

 Expanded = False

 FieldName = 'AGE'

 Title.Caption = 'â³ê'

 Width = 38

 Visible = True

 end

 item

 Expanded = False

 FieldName = 'CHARACT'

 Title.Caption = 'õàðàêòåðèñòèêà'

 Visible = True

 end

 item

 Expanded = False

 FieldName = 'PHOTO'

 Title.Caption = 'ôîòî'

 Visible = True

 end>

 end

 object pr_Button: TButton

 Left = 326

 Top = 319

 Width = 75

 Height = 20

 Hint = 'Õàðàêòåðèñòèêà, ôîòîãðàôèÿ'

 Caption = '&Á³ëüøå ...'

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clWindowText

 Font.Height = -13

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 ParentFont = False

 ParentShowHint = False

 ShowHint = True

 TabOrder = 2

 OnClick = pr_ButtonClick

 end

 object pr_DBNavigator: TDBNavigator

 Left = 73

 Top = 319

 Width = 244

 Height = 20

 DataSource = pr_DataSource

 VisibleButtons = [nbFirst, nbPrior, nbNext, nbLast]

 TabOrder = 3

 end

 end

 object dp_DataSource: TDataSource

 DataSet = dp_Query

 Left = 140

 Top = 55

 end

 object pr_DataSource: TDataSource

 DataSet = pr_Query

 Left = 298

 Top = 268

 end

 object dp_Query: TQuery

 DatabaseName = 'dbP'

 RequestLive = True

 SQL.Strings = (

 'Select * from Dep where DEP = :PDEP')

 Left = 169

 Top = 55

 ParamData = <

 item

 DataType = ftString

 Name = 'PDEP'

 ParamType = ptUnknown

 end>

 object dp_QueryDEP: TStringField

 FieldName = 'DEP'

 Origin = 'DEP.DEP'

 Size = 15

 end

 object dp_QueryPROISV: TStringField

 FieldName = 'PROISV'

 Origin = 'DEP.PROISV'

 Size = 15

 end

 end

 object update_Query: TQuery

 DatabaseName = 'dbP'

 DataSource = pr_DataSource

 RequestLive = True

 Left = 356

 Top = 268

 end

 object pr_Query: TQuery

 BeforePost = pr_QueryBeforePost

 AfterScroll = pr_QueryAfterScroll

 OnCalcFields = pr_QueryCalcFields

 DatabaseName = 'dbP'

 RequestLive = True

 SQL.Strings = (

 'Select * from Pers where DEP = :DEP order by FAM,NAM,PAR')

 Left = 327

 Top = 268

 ParamData = <

 item

 DataType = ftString

 Name = 'DEP'

 ParamType = ptUnknown

 end>

 object pr_QueryNUM: TSmallintField

 FieldName = 'NUM'

 Origin = 'PERS.NUM'

 end

 object pr_QueryDEP: TStringField

 FieldName = 'DEP'

 Origin = 'PERS.DEP'

 Size = 15

 end

 object pr_QueryFAM: TStringField

 FieldName = 'FAM'

 Origin = 'PERS.FAM'

 end

 object pr_QueryNAM: TStringField

 FieldName = 'NAM'

 Origin = 'PERS.NAM'

 end

 object pr_QueryPAR: TStringField

 FieldName = 'PAR'

 Origin = 'PERS.PAR'

 end

 object pr_QueryYEAR_B: TSmallintField

 FieldName = 'YEAR_B'

 Origin = 'PERS.YEAR_B'

 end

 object pr_QuerySEX: TStringField

 FieldName = 'SEX'

 Origin = 'PERS.SEX'

 Size = 1

 end

 object pr_QueryCHARACT: TBlobField

 FieldName = 'CHARACT'

 Origin = 'PERS.CHARACT'

 BlobType = ftMemo

 Size = 1

 end

 object pr_QueryPHOTO: TBlobField

 FieldName = 'PHOTO'

 Origin = 'PERS.PHOTO'

 BlobType = ftGraphic

 Size = 1

 end

 object pr_QueryAGE: TSmallintField

 Alignment = taCenter

 DisplayLabel = 'Âîçðàñò'

 DisplayWidth = 7

 FieldKind = fkCalculated

 FieldName = 'AGE'

 Calculated = True

 end

 end

end

ϳäëåãëó ôîðìó character_Form íàâåäåíî íà ìàë. 1.14.

 Ìàëþíîê 1.14

Òåêñòîâèé îïèñ ö³º¿ ôîðìè íàâåäåíî íèæ÷å:

object character_Form: Tcharacter_Form

 Left = 237

 Top = 95

 Width = 318

 Height = 226

 Caption = 'Õàðàêòåðèñòèêà'

 Color = clBtnFace

 Font.Charset = DEFAULT_CHARSET

 Font.Color = clWindowText

 Font.Height = -11

 Font.Name = 'MS Sans Serif'

 Font.Style = []

 FormStyle = fsStayOnTop

 OldCreateOrder = True

 Position = poDefaultPosOnly

 PixelsPerInch = 96

 TextHeight = 13

 object character_DBMemo: TDBMemo

 Left = 0

 Top = 0

 Width = 195

 Height = 194

 Align = alClient

 Alignment = taCenter

 DataField = 'Charact'

 DataSource = main_Form.pr_DataSource

 ScrollBars = ssVertical

 TabOrder = 0

 end

 object PPhoto: TPanel

 Left = 195

 Top = 0

 Width = 115

 Height = 194

 Align = alRight

 Caption = 'PPhoto'

 TabOrder = 1

 object photo_DBImage: TDBImage

 Left = 5

 Top = 42

 Width = 105

 Height = 105

 DataField = 'Photo'

 DataSource = main_Form.pr_DataSource

 TabOrder = 0

 end

 end

end

Äëÿ ôóíêö³îíóâàííÿ ïðèêëàäåííÿ ðîçðîáëåíî ïðîãðàìó:

Ôàéë Udb.h

#ifndef UdbH

#define UdbH

#include <Classes.hpp>

#include <Controls.hpp>

#include <StdCtrls.hpp>

#include <Forms.hpp>

#include <ComCtrls.hpp>

#include <DBCtrls.hpp>

#include <DBGrids.hpp>

#include <ExtCtrls.hpp>

#include <Grids.hpp>

#include <Mask.hpp>

#include <Db.hpp>

#include <DBTables.hpp>

#include "cspin.h"

#include "CSPIN.h"

#include <jpeg.hpp>

#include <Buttons.hpp>

#include <Graphics.hpp>

class Tmain_Form : public TForm

{

__published: // IDE-managed Components

 TPageControl *PageControl;

 TTabSheet *find_TabSheet;

 TRadioGroup *sex_RadioGroup;

 TEdit *speedfind_Edit;

 TDataSource *dp_DataSource;

 TDataSource *pr_DataSource;

TTabSheet *TabEdit;

 TComboBox *chdp_ComboBox;

 TEdit *chfam_Edit;

 TEdit *chname_Edit;

 TEdit *chgrand_Edit;

 TRadioGroup *sex2_RadioGroup;

 TButton *chadd_Button;

 TButton *chdelete_Button;

 TButton *chpost_Button;

 TCSpinEdit *chyear_CSpinEdit;

 TCSpinEdit *minage_CSpinEdit;

 TCSpinEdit *maxage_CSpinEdit;

 TPanel *left_Panel;

 TPanel *find_TPanel;

 TLabel *find_Label;

 TGroupBox *dp_GroupBox;

 TGroupBox *dp2_GroupBox;

 TGroupBox *pr_GroupBox;

 TDBGrid *pr_DBGrid;

 TButton *pr_Button;

 TDBNavigator *pr_DBNavigator;

 TGroupBox *ch_GroupBox;

 TLabel *chdp_Label;

 TLabel *chname_Label;

 TLabel *chgrand_Label;

 TLabel *chyear_Label;

 TLabel *chfam_Label;

 TGroupBox *age_GroupBox;

 TLabel *minage_Label;

 TLabel *maxage_Label;

 TGroupBox *speedfind_GroupBox;

 TLabel *speedfind_Label;

 TImage *speedfind_Image;

 TImage *minage_Image;

 TImage *maxage_Image;

 TAnimate *find_Animate;

 TBitBtn *select_BitBtn;

 TGroupBox *select_GroupBox;

 TQuery *dp_Query;

 TQuery *update_Query;

 TQuery *pr_Query;

 TComboBox *dp_ComboBox;

 TDBEdit *dp2_DBEdit;

 TStringField *dp_QueryDEP;

 TStringField *dp_QueryPROISV;

 TSmallintField *pr_QueryNUM;

 TStringField *pr_QueryDEP;

 TStringField *pr_QueryFAM;

 TStringField *pr_QueryNAM;

 TStringField *pr_QueryPAR;

 TSmallintField *pr_QueryYEAR_B;

 TStringField *pr_QuerySEX;

 TBlobField *pr_QueryCHARACT;

 TBlobField *pr_QueryPHOTO;

 TSmallintField *pr_QueryAGE;

 TLabel *pr_Label;

 TBevel *Bevel1;

 TGroupBox *GroupBox1;

 TLabel *sql_Label;

 TAnimate *Animate1;

 TBevel *oper_Bevel;

 TShape *oper_Shape;

 TImage *Image1;

void __fastcall FormCreate(TObject *Sender);

void __fastcall dp_ComboBoxChange(TObject *Sender);

void __fastcall pr_ButtonClick(TObject *Sender);

void __fastcall speedfind_EditChange(TObject *Sender);

void __fastcall pr_QueryCalcFields(TDataSet *DataSet);

void __fastcall pr_QueryAfterScroll(TDataSet *DataSet);

void __fastcall pr_QueryBeforePost(TDataSet *DataSet);

void __fastcall chadd_ButtonClick(TObject *Sender);

void __fastcall chdelete_ButtonClick(TObject *Sender);

void __fastcall chpost_ButtonClick(TObject *Sender);

void __fastcall PageControlChange(TObject *Sender);

 void __fastcall minage_CSpinEditChange(TObject *Sender);

 void __fastcall select_BitBtnClick(TObject *Sender);

 void __fastcall pr_DBGridCellClick(TColumn *Column);

private: // User declarations

public: // User declarations

__fastcall Tmain_Form(TComponent* Owner);

 unsigned short Year;

 unsigned short Month;

 unsigned short Day;

 bool CanPost;

 int AllPers, CurrentPers;

 AnsiString sql_Operator;

 void __fastcall Delay(unsigned long int mSeconds);

};

extern PACKAGE Tmain_Form *main_Form;

#endif

Ôàéë Udb.cpp

#include <vcl.h>

#pragma hdrstop

#include "Udb.h"

#include "Udba.h"

#pragma package(smart_init)

#pragma link "cspin"

#pragma link "CSPIN"

#pragma resource "*.dfm"

Tmain_Form *main_Form;

__fastcall Tmain_Form::Tmain_Form(TComponent* Owner)

: TForm(Owner)

{}

void __fastcall Tmain_Form::FormCreate(TObject *Sender)

{

 CanPost = false;

 Date().DecodeDate(&Year,&Month,&Day);

 // ï³äðàõóâàííÿ ê³ëüêîñò³ çàïèñ³â ó òàáëèö³ PERS

 pr_Query->SQL->Clear();

 sql_Operator = "Select * from PERS order by NUM";

 sql_Label->Caption = sql_Operator;

 pr_Query->SQL->Add(sql_Operator);

 pr_Query->Open();

 pr_Query->First();

 AllPers = 0;

 while (!pr_Query->Eof) {

 ++AllPers;

 pr_Query->Next();

 }

 pr_Query->First();

 dp_Query->SQL->Clear();

 sql_Operator = "Select * from DEP";

 sql_Label->Caption = sql_Operator;

 dp_Query->SQL->Add(sql_Operator);

 dp_Query->Open();

 dp_Query->First();

 // Çàïîâíåííÿ ComboBox dp_ComboBox òà chdp_ComboBox íàéìóâàííÿìè â³ää³ëê³â

 dp_ComboBox->Clear();

 chdp_ComboBox->Clear();

 while (!dp_Query->Eof) {

 dp_ComboBox->Items->Add(dp_QueryDEP->AsString);

 chdp_ComboBox->Items->Add(dp_QueryDEP->AsString);

 dp_Query->Next();

 }

 dp_ComboBox->Items->Add("óñ³ â³ää³ëêè");

 dp_ComboBox->ItemIndex = dp_ComboBox->Items->Count - 1;

 dp_ComboBoxChange(Sender);

 chdp_ComboBox->ItemIndex = dp_ComboBox->ItemIndex;

 PageControl->ActivePage = find_TabSheet;

}

void __fastcall Tmain_Form::dp_ComboBoxChange(TObject *Sender)

{

 dp_Query->Close();

 dp_Query->SQL->Clear();

 sql_Operator = "Select * from DEP where DEP=:PDEP";

 sql_Label->Caption = sql_Operator;

 Delay(5000);

 dp_Query->SQL->Add(sql_Operator);

 dp_Query->Params->Items[0]->AsString = dp_ComboBox->Text;

 dp_Query->Open();

 dp_Query->First();

 pr_Query->Close();

 pr_Query->SQL->Clear();

 if (dp_ComboBox->ItemIndex == dp_ComboBox->Items->Count - 1) {

 sql_Operator = "Select * from PERS order by NUM";

 sql_Label->Caption = sql_Operator;

 Delay(5000);

 pr_Query->SQL->Add(sql_Operator);

 } else {

 sql_Operator = "Select * from PERS where DEP = :DEP order by NUM";

 sql_Label->Caption = sql_Operator;

 Delay(5000);

 pr_Query->SQL->Add(sql_Operator);

 pr_Query->Params->Items[0]->AsString = dp_ComboBox->Text;

 }

 pr_Query->ExecSQL();

 pr_Query->Open();

 pr_Query->First();

}

void __fastcall Tmain_Form::pr_ButtonClick(TObject *Sender)

{

 if (!character_Form->Visible) character_Form->Show();

}

void __fastcall Tmain_Form::speedfind_EditChange(TObject *Sender)

{

 TLocateOptions SearchOptions;

 pr_Query->Locate("FAM", speedfind_Edit->Text,

 SearchOptions << loPartialKey << loCaseInsensitive);

}

void __fastcall Tmain_Form::pr_QueryCalcFields(TDataSet *DataSet)

{

 pr_QueryAGE->Value = Year - pr_QueryYEAR_B->Value;

}

void __fastcall Tmain_Form::pr_QueryAfterScroll(TDataSet *DataSet)

{

 // ïîòî÷íà ïåðñîíà

 CurrentPers = pr_QueryNUM->AsInteger;

 pr_Label->Caption = IntToStr(CurrentPers);

 if (PageControl->ActivePage == TabEdit) {

 // â³äîáðàæåííÿ äàíèõ ïðî ïîòî÷íó ïåðñîíó

 chdp_ComboBox -> ItemIndex =

 chdp_ComboBox->Items->IndexOf(pr_QueryDEP->AsString);

 chfam_Edit->Text = pr_QueryFAM->AsString;

 chname_Edit->Text = pr_QueryNAM->AsString;

 chgrand_Edit->Text = pr_QueryPAR->AsString;

 chyear_CSpinEdit->Value = pr_QueryYEAR_B->AsInteger;

 if (pr_QuerySEX->AsString == "÷") sex2_RadioGroup->ItemIndex = 0;

 else sex2_RadioGroup->ItemIndex = 1;

 }

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::pr_QueryBeforePost(TDataSet *DataSet)

{

 if (!CanPost) {

 DataSet->Cancel();

 Abort;

 }

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::chadd_ButtonClick(TObject *Sender)

{ // äîäàâàííÿ çàïèñó äî òàáëèö³ PERS

 AnsiString NewSex; // âèçíà÷åííÿ ñòàò³

 if (sex2_RadioGroup->ItemIndex == 0) NewSex = "÷";

 else NewSex = "æ";

 update_Query->Close();

 update_Query->SQL->Clear();

 sql_Operator = "Insert into PERS (DEP,FAM,NAM,PAR,YEAR_B,SEX,NUM) values ('"

 + chdp_ComboBox->Text + "','"

 + chfam_Edit->Text + "','"

 + chname_Edit->Text + "','"

 + chgrand_Edit->Text + "','"

 + IntToStr((int)chyear_CSpinEdit->Value) + "','"

 + NewSex + "','"

 + IntToStr(++AllPers) + "')"; // çá³ëüøåííÿ ê³ëüêîñò³ çàïèñ³â ó òàáëèö³ PERS

 sql_Label->Caption = sql_Operator;

 Delay(5000);

 update_Query->SQL->Add(sql_Operator);

 update_Query->ExecSQL(); // äîäàâàííÿ çàïèñó

 pr_Query->Close(); // ïîíîâëåííÿ â³äîáðàæåííÿ äàíèõ òàáëèö³ PERS

 pr_Query->Open();

 PageControlChange(Sender);

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::chdelete_ButtonClick(TObject *Sender)

{ // âèäàëåííÿ ïîòî÷íîãî çàïèñó ç òàáëèö³ PERS

 if (Application->MessageBox("Âè ä³éñíî áàæàºòå âèäàëèòè ïîòî÷íèé çàïèñ?",

 "ϳäòâåðä³òü âèäàëåííÿ çàïèñó",

 MB_YESNO + MB_ICONEXCLAMATION) == IDYES)

 update_Query->Close();

 update_Query->SQL->Clear();

 sql_Operator = "Delete from PERS where NUM = " + IntToStr(CurrentPers);

 sql_Label->Caption = sql_Operator;

 Delay(5000);

 update_Query->SQL->Add(sql_Operator);

 update_Query->ExecSQL(); // âèäàëåííÿ çàïèñó

 pr_Query->Close(); // ïîíîâëåííÿ â³äîáðàæåííÿ äàíèõ òàëèö³ PERS

 pr_Query->Open();

 --AllPers; // çìåíøåííÿ ê³ëüêîñò³ çàïèñ³â ó òàáëèö³ PERS

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::chpost_ButtonClick(TObject *Sender)

{

 AnsiString s, sSQL;

 const AnsiString s1 = ",";

 s = "";

 sSQL = "Update PERS set ";

 if (pr_QueryDEP->AsString != chdp_ComboBox->Text) {

 s = "â³ää³ëîê";

 sSQL += "DEP='" + chdp_ComboBox->Text + "'";

 }

 if (pr_QueryCHARACT->AsString != chfam_Edit->Text) {

 if (s != "") { s += s1; sSQL += s1; }

 s += " ïð³çâèùå";

 sSQL += "FAM='" + chfam_Edit->Text + "'";

 }

 if (pr_QueryCHARACT->AsString != chname_Edit->Text) {

 if (s != "") { s += s1; sSQL += s1; }

 s += " ³ì'ÿ";

 sSQL += "NAM='" + chname_Edit->Text+"'";

 }

 if (pr_QueryCHARACT->AsString != chgrand_Edit->Text) {

 if (s != "") { s += s1; sSQL += s1; }

 s += " ïî áàòüêîâ³";

 sSQL += "PAR='" + chgrand_Edit->Text + "'";

 }

 if (pr_QueryYEAR_B->AsInteger != chyear_CSpinEdit->Value) {

 if (s != "") { s += s1; sSQL += s1; }

 s += " ð³ê íàðîäæåííÿ";

 sSQL += "YEAR_B='" + IntToStr((int)(chyear_CSpinEdit->Value));

 }

 if (pr_QuerySEX->AsBoolean != (sex2_RadioGroup->ItemIndex == 0)) {

 if (s != "") { s += s1; sSQL += s1; }

 s += " ñòàòü";

 sSQL += "SEX='";

 if(sex2_RadioGroup->ItemIndex == 0) sSQL += "÷'";

 else sSQL += "æ'";

 }

 if (s != "")

 if (Application->MessageBox(

 ("ijéñíî áàæàºòå çì³íèòè " + s + "?").c_str(),

 "ϳäòâåðä³òü çàíåñåííÿ çì³í ó áàçó äàíèõ",

 MB_YESNO + MB_ICONQUESTION) == IDYES)

 { update_Query->Close();

 update_Query->SQL->Clear();

 sql_Operator = sSQL + " where NUM=" + IntToStr(pr_QueryNUM->AsInteger);

 sql_Label->Caption = sql_Operator;

 Delay(5000);

 update_Query->SQL->Add(sql_Operator);

 update_Query->ExecSQL();

 pr_Query->Close();

 pr_Query->Open();

 CanPost = false;

 };

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::PageControlChange(TObject *Sender)

{

 character_Form->character_DBMemo->ReadOnly =

 !(PageControl->ActivePage == TabEdit);

 if (PageControl->ActivePage == TabEdit) pr_QueryAfterScroll(pr_Query);

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::minage_CSpinEditChange(TObject *Sender)

{

 AnsiString s =

 "(YEAR_B<=" + IntToStr(int(Year - minage_CSpinEdit->Value)) +

 ")and(YEAR_B>=" + IntToStr(int(Year - maxage_CSpinEdit->Value)) +

 ")and(SEX=";

 if (!sex_RadioGroup->ItemIndex) s += "'÷')";

 else s += "'æ')";

 // àâòîìàòè÷íå ïîíîâëåííÿ â³äáîðó çàïèñ³â

 select_BitBtn->Kind = bkCancel;

 select_BitBtn->Caption = "³äì³íèòè â³äá³ð";

 pr_Query->Filter = s;

 pr_Query->Filtered = true;

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::select_BitBtnClick(TObject *Sender)

{

 if (pr_Query->Filtered) { // â³äì³íà ðåæèìó ô³ëüòðàö³¿

 pr_Query->Filtered = false;

 select_BitBtn->Kind = bkYes;

 select_BitBtn->Caption = "Ïîíîâèòè â³äá³ð";

 } else { // âñòàíîâëåííÿ ðåæèìó ô³ëüòðàö³¿

 select_BitBtn->Kind = bkCancel;

 select_BitBtn->Caption = "³äì³íèòè â³äá³ð";

 minage_CSpinEditChange(Sender);

 }

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::pr_DBGridCellClick(TColumn *Column)

{

 if (PageControl->ActivePage == TabEdit) {

 chdp_ComboBox -> ItemIndex =

 chdp_ComboBox->Items->IndexOf(pr_QueryDEP->AsString);

 chfam_Edit->Text = pr_QueryFAM->AsString;

 chname_Edit->Text = pr_QueryNAM->AsString;

 chgrand_Edit->Text = pr_QueryPAR->AsString;

 chyear_CSpinEdit->Value = pr_QueryYEAR_B->AsInteger;

 if (pr_QuerySEX->AsString == "÷") sex2_RadioGroup->ItemIndex = 0;

 else sex2_RadioGroup->ItemIndex = 1;

 }

 // ïîòî÷íà ïåðñîíà

 CurrentPers = pr_QueryNUM->AsInteger;

 pr_Label->Caption = IntToStr(CurrentPers);

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::Delay(unsigned long int mSeconds)

{ // çàòðèìêà íà äåê³ëüêà ì³ë³ñåêóíä

 unsigned long int FirstTick;

 FirstTick = GetTickCount();

 do

 Application->ProcessMessages();

 while (GetTickCount() - FirstTick <= mSeconds);

}

Ôàéë Udba.h

//---------------------------------------------------------------------------

#ifndef UdbaH

#define UdbaH

//---------------------------------------------------------------------------

#include <Classes.hpp>

#include <Controls.hpp>

#include <StdCtrls.hpp>

#include <Forms.hpp>

#include <DBCtrls.hpp>

#include <ExtCtrls.hpp>

//---------------------------------------------------------------------------

class Tcharacter_Form : public TForm

{

__published: // IDE-managed Components

 TDBMemo *character_DBMemo;

TPanel *PPhoto;

 TDBImage *photo_DBImage;

private: // User declarations

public: // User declarations

__fastcall Tcharacter_Form(TComponent* Owner);

};

//---------------------------------------------------------------------------

extern PACKAGE Tcharacter_Form *character_Form;

//---------------------------------------------------------------------------

#endif

Ôàéë Udba.cpp

//---------------------------------------------------------------------------

#include <vcl.h>

#pragma hdrstop

#include "Udba.h"

#include "Udb.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

#pragma resource "*.dfm"

Tcharacter_Form *character_Form;

//---------------------------------------------------------------------------

__fastcall Tcharacter_Form::Tcharacter_Form(TComponent* Owner)

: TForm(Owner)

{

}

//---------------------------------------------------------------------------

Äëÿ âèêîíàííÿ ïðèêëàäåííÿ òðåáà ïîïåðåäíüî çàâàíòàæèòè íà âèêîíàííÿ ïðèêëàäåííÿ-ñåðâåð IBServer.EXE, ÿêå çà çâè÷àé çíàõîäèòüñÿ çà ìàðøðóòîì "E:\Program Files\InterBase Corp\InterBase\Bin\" ³ îáñëóãîâóº çàïèòè äî áàçè äàíèõ Interbase. ϳñëÿ çàâàíòàæåííÿ ïîòî÷-íîãî ïðîåêòó íà âèêîíàííÿ öåé ñåðâåð âèâîäèòü íà åêðàí çàïèò (ìàë.. 1.15) , ó ïîë³ Password: ÿêîãî òðåáà ââåñòè ïàðîëü äîñòóïó masterkey..

 

Ìàëþíîê 1.15

Ôîðìè ï³ä ÷àñ ôóíêö³îíóâàííÿ ïðèêëàäåííÿ íàâåäåíî íà ìàë. 1.16 - 1.18.

 

Ìàëþíîê 1.16

Ìàëþíîê 1.17

 Ìàëþíîê 1.18

Âêàç³âêè äî ñòâîðåííÿ äðóãîãî ïðèêëàäåííÿ: Äëÿ ìàí³ïóëþâàííÿ òàáëèöÿìè ìîæíà âèêîðèñòàòè êîðåãîâàíèé ïðîåêò ïîïåðåäíüîãî ïðèêëàäåííÿ (ìàë. 1.19).

Ìàëþíîê 1.19

Ãîëîâíó ôîðìó main_Form íàâåäåíî íà ìàë. 1.20.

Ìàëþíîê 1.20

Òåêñòîâèé îïèñ ôîðìè main_Form:

object main_Form: Tmain_Form

 Left = 63

 Top = 22

 Width = 709

 Height = 461

 Caption = 'Ëàáîðàòîðíà ðîáîòà 3'

 Color = clBtnFace

 Font.Charset = DEFAULT_CHARSET

 Font.Color = clWindowText

 Font.Height = -11

 Font.Name = 'System'

 Font.Style = [fsBold]

 OldCreateOrder = True

 Position = poScreenCenter

 OnCreate = FormCreate

 PixelsPerInch = 96

 TextHeight = 16

 object PageControl: TPageControl

 Left = 421

 Top = 0

 Width = 280

 Height = 429

 ActivePage = find_TabSheet

 Align = alClient

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clWindowText

 Font.Height = -13

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 MultiLine = True

 ParentFont = False

 TabOrder = 0

 OnChange = PageControlChange

 object find_TabSheet: TTabSheet

 Caption = '³äá³ð'

 object select_GroupBox: TGroupBox

 Left = 1

 Top = 5

 Width = 268

 Height = 212

 Caption = '³äá³ð çà ...'

 TabOrder = 7

 end

 object sex_RadioGroup: TRadioGroup

 Left = 8

 Top = 120

 Width = 257

 Height = 53

 Caption = ' ñòàòòþ '

 Columns = 2

 ItemIndex = 0

 Items.Strings = (

 '÷îëîâ³÷à'

 'æ³íî÷à')

 TabOrder = 0

 OnClick = minage_CSpinEditChange

 end

 object speedfind_GroupBox: TGroupBox

 Left = 0

 Top = 224

 Width = 257

 Height = 169

 Caption = ' Øâèäêèé ïîøóê çà ïð³çâèùåì '

 TabOrder = 5

 object Image1: TImage

 Left = 8

 Top = 16

 Width = 105

 Height = 145

 Picture.Data = {}

 Stretch = True

 end

 object speedfind_Label: TLabel

 Left = 154

 Top = 50

 Width = 56

 Height = 16

 Caption = 'Ïð³çâèùå'

 end

 object speedfind_Image: TImage

 Left = 32

 Top = 48

 Width = 57

 Height = 73

 Picture.Data = {}

 Stretch = True

 end

 end

 object age_GroupBox: TGroupBox

 Left = 8

 Top = 32

 Width = 257

 Height = 81

 Caption = ' â³êîì '

 Enabled = False

 TabOrder = 4

 object minage_Label: TLabel

 Left = 65

 Top = 15

 Width = 28

 Height = 16

 Caption = 'â³ä ...'

 end

 object maxage_Label: TLabel

 Left = 192

 Top = 15

 Width = 25

 Height = 16

 Caption = 'äî ...'

 end

 object minage_Image: TImage

 Left = 8

 Top = 24

 Width = 41

 Height = 49

 Picture.Data = {}

 Stretch = True

 Transparent = True

 end

 object maxage_Image: TImage

 Left = 136

 Top = 24

 Width = 41

 Height = 49

 Picture.Data = {}

 Stretch = True

 Transparent = True

 end

 end

 object speedfind_Edit: TEdit

 Left = 120

 Top = 310

 Width = 129

 Height = 22

 Hint = 'Ââîä ôàìèëèè'

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clWindowText

 Font.Height = -11

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 ParentFont = False

 ParentShowHint = False

 ShowHint = True

 TabOrder = 1

 OnChange = speedfind_EditChange

 end

 object minage_CSpinEdit: TCSpinEdit

 Left = 62

 Top = 66

 Width = 65

 Height = 26

 TabStop = True

 MaxValue = 80

 MinValue = 16

 ParentColor = False

 TabOrder = 2

 Value = 16

 OnChange = minage_CSpinEditChange

 end

 object maxage_CSpinEdit: TCSpinEdit

 Left = 190

 Top = 66

 Width = 65

 Height = 26

 TabStop = True

 MaxValue = 80

 MinValue = 16

 ParentColor = False

 TabOrder = 3

 Value = 30

 OnChange = minage_CSpinEditChange

 end

 object select_BitBtn: TBitBtn

 Left = 8

 Top = 184

 Width = 257

 Height = 25

 Cursor = crHandPoint

 Caption = 'Ïîíîâèòè â³äá³ð'

 TabOrder = 6

 OnClick = select_BitBtnClick

 Kind = bkOK

 end

 end

 object TabEdit: TTabSheet

 Caption = 'Êîðåãóâàííÿ'

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clBlack

 Font.Height = -13

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 ParentFont = False

 object ch_GroupBox: TGroupBox

 Left = 2

 Top = 5

 Width = 269

 Height = 388

 Caption = ' Çàãàëüí³ â³äîìîñò³ '

 TabOrder = 9

 object chdp_Label: TLabel

 Left = 12

 Top = 38

 Width = 50

 Height = 16

 Caption = '³ää³ëîê'

 FocusControl = chdp_ComboBox

 end

 object chname_Label: TLabel

 Left = 12

 Top = 138

 Width = 25

 Height = 16

 Caption = '²ì'#39'ÿ'

 FocusControl = chname_Edit

 end

 object chgrand_Label: TLabel

 Left = 12

 Top = 188

 Width = 73

 Height = 16

 Caption = 'Ïî áàòüêîâ³'

 FocusControl = chgrand_Edit

 end

 object chyear_Label: TLabel

 Left = 12

 Top = 232

 Width = 95

 Height = 16

 Caption = 'гê íàðîäæåííÿ'

 end

 object chfam_Label: TLabel

 Left = 12

 Top = 87

 Width = 56

 Height = 16

 Caption = 'Ïð³çâèùå'

 FocusControl = chfam_Edit

 end

 object oper_Bevel: TBevel

 Left = 18

 Top = 282

 Width = 251

 Height = 96

 end

 object oper_Shape: TShape

 Left = 19

 Top = 283

 Width = 248

 Height = 94

 Brush.Color = clBlack

 end

 object Animate1: TAnimate

 Left = 24

 Top = 291

 Width = 60

 Height = 80

 Active = True

 FileName = 'Frage.avi'

 StopFrame = 31

 Transparent = False

 end

 end

 object sex2_RadioGroup: TRadioGroup

 Left = 185

 Top = 218

 Width = 77

 Height = 41

 Caption = 'Ñòàòü'

 Columns = 2

 ItemIndex = 0

 Items.Strings = (

 '÷'

 'æ')

 TabOrder = 4

 end

 object chdp_ComboBox: TComboBox

 Left = 101

 Top = 40

 Width = 162

 Height = 22

 Style = csDropDownList

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clBlack

 Font.Height = -11

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 ItemHeight = 14

 ParentFont = False

 TabOrder = 0

 end

 object chfam_Edit: TEdit

 Left = 101

 Top = 90

 Width = 162

 Height = 22

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clBlack

 Font.Height = -11

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 ParentFont = False

 TabOrder = 1

 Text = 'chfam_Edit'

 end

 object chname_Edit: TEdit

 Left = 101

 Top = 140

 Width = 162

 Height = 22

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clBlack

 Font.Height = -11

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 ParentFont = False

 TabOrder = 2

 Text = 'chname_Edit'

 end

 object chgrand_Edit: TEdit

 Left = 101

 Top = 190

 Width = 162

 Height = 22

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clBlack

 Font.Height = -11

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 ParentFont = False

 TabOrder = 3

 Text = 'chgrand_Edit'

 end

 object chadd_Button: TButton

 Left = 88

 Top = 294

 Width = 169

 Height = 25

 Hint = 'Íîâàÿ çàïèñü'

 Caption = '&Äîäàòè'

 ParentShowHint = False

 ShowHint = True

 TabOrder = 5

 OnClick = chadd_ButtonClick

 end

 object chdelete_Button: TButton

 Left = 88

 Top = 322

 Width = 169

 Height = 25

 Hint = 'Óäàëåíèå çàïèñè'

 Caption = '&Âèäàëèòè'

 ParentShowHint = False

 ShowHint = True

 TabOrder = 6

 OnClick = chdelete_ButtonClick

 end

 object chpost_Button: TButton

 Left = 88

 Top = 351

 Width = 169

 Height = 25

 Hint = 'Ôèêñàöèÿ èçìåíåíèé'

 Caption = '&Ïîíîâèòè'

 ParentShowHint = False

 ShowHint = True

 TabOrder = 7

 OnClick = chpost_ButtonClick

 end

 object chyear_CSpinEdit: TCSpinEdit

 Left = 119

 Top = 233

 Width = 50

 Height = 23

 TabStop = True

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clBlack

 Font.Height = -11

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 MaxValue = 2000

 MinValue = 1900

 ParentColor = False

 ParentFont = False

 TabOrder = 8

 Value = 1950

 end

 end

 end

 object left_Panel: TPanel

 Left = 0

 Top = 0

 Width = 421

 Height = 429

 Align = alLeft

 BevelInner = bvLowered

 Caption = 'left_Panel'

 TabOrder = 1

 object find_TPanel: TPanel

 Left = 6

 Top = 5

 Width = 406

 Height = 420

 Caption = 'find_TPanel'

 TabOrder = 1

 object find_Label: TLabel

 Left = 109

 Top = 16

 Width = 265

 Height = 24

 Alignment = taCenter

 Caption = 'ÏÎØÓÊ ÑϲÂÐÎÁ²ÒÍÈʲÂ'

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clRed

 Font.Height = -21

 Font.Name = 'Arial Cyr'

 Font.Style = [fsBold, fsItalic]

 ParentFont = False

 end

 object dp_GroupBox: TGroupBox

 Left = 8

 Top = 48

 Width = 393

 Height = 65

 Caption = ' ³ää³ëîê '

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clWindowText

 Font.Height = -13

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 ParentFont = False

 TabOrder = 0

 object dp_ComboBox: TComboBox

 Left = 14

 Top = 22

 Width = 155

 Height = 24

 ItemHeight = 16

 Items.Strings = (

 'Áóõãàëòåðèÿ')

 TabOrder = 0

 OnChange = dp_ComboBoxChange

 end

 end

 object dp2_GroupBox: TGroupBox

 Left = 216

 Top = 58

 Width = 169

 Height = 46

 Caption = ' ï³äðîçä³ë '

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clWindowText

 Font.Height = -13

 Font.Name = 'Times New Roman'

 Font.Style = [fsItalic]

 ParentFont = False

 TabOrder = 1

 object dp2_DBEdit: TDBEdit

 Left = 5

 Top = 15

 Width = 156

 Height = 23

 Color = clSilver

 DataField = 'PROISV'

 DataSource = dp_DataSource

 Enabled = False

 TabOrder = 0

 end

 end

 object pr_GroupBox: TGroupBox

 Left = 8

 Top = 113

 Width = 393

 Height = 226

 Caption = ' Ñï³âðîá³òíèêè '

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clWindowText

 Font.Height = -13

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 ParentFont = False

 TabOrder = 2

 object pr_Panel: TPanel

 Left = 9

 Top = 196

 Width = 66

 Height = 26

 TabOrder = 0

 object pr_Label: TLabel

 Left = 9

 Top = 3

 Width = 47

 Height = 20

 Alignment = taCenter

 AutoSize = False

 Caption = '1'

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clRed

 Font.Height = -13

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 ParentFont = False

 Layout = tlCenter

 end

 end

 end

 object find_Animate: TAnimate

 Left = 40

 Top = 4

 Width = 48

 Height = 45

 Active = True

 CommonAVI = aviFindComputer

 StopFrame = 8

 end

 object GroupBox1: TGroupBox

 Left = 8

 Top = 340

 Width = 393

 Height = 77

 Caption = 'Ïîòî÷íèé îïåðàòîð SQL'

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clWindowText

 Font.Height = -13

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 ParentFont = False

 TabOrder = 4

 object sql_Label: TLabel

 Left = 11

 Top = 16

 Width = 372

 Height = 57

 AutoSize = False

 Color = clBtnFace

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clRed

 Font.Height = -13

 Font.Name = 'Times New Roman'

 Font.Style = [fsBold, fsItalic]

 ParentColor = False

 ParentFont = False

 WordWrap = True

 end

 end

 end

 object pr_DBGrid: TDBGrid

 Left = 22

 Top = 136

 Width = 378

 Height = 173

 DataSource = pr_DataSource

 Font.Charset = RUSSIAN_CHARSET

 Font.Color = clWindowText

 Font.Height = -11

 Font.Name = 'Times New Roman'

 Font.Style = [fsItalic]

 Options = [dgTitles, dgIndicator, dgColumnResize, dgColLines, dgRowLines, dgTabs, dgConfirmDelete, dgCancelOnExit]

 ParentFont = False

 TabOrder = 0

 TitleFont.Charset = RUSSIAN_CHARSET

 TitleFont.Color = clWindowText

 TitleFont.Height = -11

 TitleFont.Name = 'Times New Roman'

 TitleFont.Style = [fsItalic]

 OnCellClick = pr_DBGridCellClick

 OnKeyDown = pr_DBGridKeyDown

 Columns = <

 item

 Expanded = False

 FieldName = 'FAM'

 Title.Caption = 'Ïð³çâèùå'

 Width = 59

 Visible = True

 end

 item

 Expanded = False

 FieldName = 'NAM'

 Title.Caption = '³ì'#39'ÿ'

 Width = 57

 Visible = True

 end

 item

 Expanded = False

 FieldName = 'PAR'

 Title.Caption = 'ïî áàòüêîâ³'

 Width = 67

 Visible = True

 end

 item

 Alignment = taCenter

 Expanded = False

 FieldName = 'YEAR_B'

 Title.Caption = 'ð³ê íàðîäæåííÿ'

 Width = 85

 Visible = True

 end

 item

 Alignment = taCenter

 Expanded = False

 FieldName = 'SEX'

 Title.Caption = 'ñòàòü'

 Visible = True

 end

 item

 Expanded = False

 FieldName = 'AGE'

 Title.Caption = 'â³ê'

 Width = 38

 Visible = True

 end

 item

 Expanded = False

 FieldName = 'CHARACT'

 Title.Caption = 'õàðàêòåðèñòèêà'

 Visible = True

 end

 item

 Expanded = False

 FieldName = 'PHOTO'

 Title.Caption = 'ôîòî'

 Visible = True

 end>

 end

 object pr_DBNavigator: TDBNavigator

 Left = 96

 Top = 320

 Width = 304

 Height = 18

 DataSource = pr_DataSource

 VisibleButtons = [nbFirst, nbPrior, nbNext, nbLast]

 TabOrder = 2

 end

 end

 object dp_DataSource: TDataSource

 DataSet = dp_Query

 Left = 110

 Top = 58

 end

 object pr_DataSource: TDataSource

 DataSet = pr_Query

 Left = 213

 Top = 263

 end

 object dp_Query: TQuery

 DatabaseName = 'dbP'

 RequestLive = True

 SQL.Strings = (

 'Select * from Dep where DEP = :PDEP')

 Left = 139

 Top = 58

 ParamData = <

 item

 DataType = ftString

 Name = 'PDEP'

 ParamType = ptUnknown

 end>

 object dp_QueryDEP: TStringField

 FieldName = 'DEP'

 Origin = 'DEP.DEP'

 Size = 15

 end

 object dp_QueryPROISV: TStringField

 FieldName = 'PROISV'

 Origin = 'DEP.PROISV'

 Size = 15

 end

 end

 object update_Query: TQuery

 DatabaseName = 'dbP'

 DataSource = pr_DataSource

 RequestLive = True

 Left = 271

 Top = 263

 end

 object pr_Query: TQuery

 ObjectView = True

 BeforePost = pr_QueryBeforePost

 AfterScroll = pr_QueryAfterScroll

 OnCalcFields = pr_QueryCalcFields

 DatabaseName = 'dbP'

 RequestLive = True

 SQL.Strings = (

 'Select * from Pers where DEP = :DEP order by FAM,NAM,PAR')

 Left = 242

 Top = 263

 ParamData = <

 item

 DataType = ftString

 Name = 'DEP'

 ParamType = ptUnknown

 end>

 object pr_QueryNUM: TSmallintField

 FieldName = 'NUM'

 Origin = 'PERS.NUM'

 end

 object pr_QueryDEP: TStringField

 FieldName = 'DEP'

 Origin = 'PERS.DEP'

 Size = 15

 end

 object pr_QueryFAM: TStringField

 FieldName = 'FAM'

 Origin = 'PERS.FAM'

 end

 object pr_QueryNAM: TStringField

 FieldName = 'NAM'

 Origin = 'PERS.NAM'

 end

 object pr_QueryPAR: TStringField

 FieldName = 'PAR'

 Origin = 'PERS.PAR'

 end

 object pr_QueryYEAR_B: TSmallintField

 FieldName = 'YEAR_B'

 Origin = 'PERS.YEAR_B'

 end

 object pr_QuerySEX: TStringField

 FieldName = 'SEX'

 Origin = 'PERS.SEX'

 Size = 1

 end

 object pr_QueryAGE: TSmallintField

 Alignment = taCenter

 DisplayLabel = 'Âîçðàñò'

 DisplayWidth = 7

 FieldKind = fkCalculated

 FieldName = 'AGE'

 Calculated = True

 end

 end

 object insert_StoredProc: TStoredProc

 ObjectView = True

 DatabaseName = 'dbP'

 StoredProcName = 'INSERTDBP'

 Left = 308

 Top = 263

 ParamData = <

 item

 DataType = ftString

 Name = 'PDEP'

 ParamType = ptInput

 end

 item

 DataType = ftString

 Name = 'PFAM'

 ParamType = ptInput

 end

 item

 DataType = ftString

 Name = 'PNAM'

 ParamType = ptInput

 end

 item

 DataType = ftString

 Name = 'PPAR'

 ParamType = ptInput

 end

 item

 DataType = ftInteger

 Name = 'PYEAR_B'

 ParamType = ptInput

 end

 item

 DataType = ftString

 Name = 'PSEX'

 ParamType = ptInput

 end>

 end

 object update_StoredProc: TStoredProc

 ObjectView = True

 DatabaseName = 'dbP'

 StoredProcName = 'UPDATEDBP'

 Left = 366

 Top = 263

 ParamData = <

 item

 DataType = ftString

 Name = 'PDEP'

 ParamType = ptInput

 end

 item

 DataType = ftString

 Name = 'PFAM'

 ParamType = ptInput

 end

 item

 DataType = ftString

 Name = 'PNAM'

 ParamType = ptInput

 end

 item

 DataType = ftString

 Name = 'PPAR'

 ParamType = ptInput

 end

 item

 DataType = ftInteger

 Name = 'PYEAR_B'

 ParamType = ptInput

 end

 item

 DataType = ftString

 Name = 'PSEX'

 ParamType = ptInput

 end

 item

 DataType = ftInteger

 Name = 'NUMBER'

 ParamType = ptOutput

 end>

 end

 object delete_StoredProc: TStoredProc

 ObjectView = True

 DatabaseName = 'dbP'

 StoredProcName = 'DELETEDBP'

 Left = 337

 Top = 263

 ParamData = <

 item

 DataType = ftInteger

 Name = 'PNUM'

 ParamType = ptInput

 end>

 end

end

Äëÿ ôóíêö³îíóâàííÿ ïðèêëàäåííÿ ðîçðîáëåíî ïðîãðàìó:

Ôàéë Udb.h

//---------------------------------------------------------------------------

#ifndef UdbH

#define UdbH

//---------------------------------------------------------------------------

#include <Classes.hpp>

#include <Controls.hpp>

#include <StdCtrls.hpp>

#include <Forms.hpp>

#include <ComCtrls.hpp>

#include <DBCtrls.hpp>

#include <DBGrids.hpp>

#include <ExtCtrls.hpp>

#include <Grids.hpp>

#include <Mask.hpp>

#include <Db.hpp>

#include <DBTables.hpp>

#include "cspin.h"

#include "CSPIN.h"

#include <jpeg.hpp>

#include <Buttons.hpp>

#include <Graphics.hpp>

//---------------------------------------------------------------------------

class Tmain_Form : public TForm

{

__published: // IDE-managed Components

 TPageControl *PageControl;

 TTabSheet *find_TabSheet;

 TRadioGroup *sex_RadioGroup;

 TEdit *speedfind_Edit;

 TDataSource *dp_DataSource;

 TDataSource *pr_DataSource;

TTabSheet *TabEdit;

 TComboBox *chdp_ComboBox;

 TEdit *chfam_Edit;

 TEdit *chname_Edit;

 TEdit *chgrand_Edit;

 TRadioGroup *sex2_RadioGroup;

 TButton *chadd_Button;

 TButton *chdelete_Button;

 TButton *chpost_Button;

 TCSpinEdit *chyear_CSpinEdit;

 TCSpinEdit *minage_CSpinEdit;

 TCSpinEdit *maxage_CSpinEdit;

 TPanel *left_Panel;

 TPanel *find_TPanel;

 TLabel *find_Label;

 TGroupBox *dp_GroupBox;

 TGroupBox *dp2_GroupBox;

 TGroupBox *pr_GroupBox;

 TDBGrid *pr_DBGrid;

 TDBNavigator *pr_DBNavigator;

 TGroupBox *ch_GroupBox;

 TLabel *chdp_Label;

 TLabel *chname_Label;

 TLabel *chgrand_Label;

 TLabel *chyear_Label;

 TLabel *chfam_Label;

 TGroupBox *age_GroupBox;

 TLabel *minage_Label;

 TLabel *maxage_Label;

 TGroupBox *speedfind_GroupBox;

 TLabel *speedfind_Label;

 TImage *speedfind_Image;

 TImage *minage_Image;

 TImage *maxage_Image;

 TAnimate *find_Animate;

 TBitBtn *select_BitBtn;

 TGroupBox *select_GroupBox;

 TQuery *dp_Query;

 TQuery *update_Query;

 TComboBox *dp_ComboBox;

 TDBEdit *dp2_DBEdit;

 TStringField *dp_QueryDEP;

 TStringField *dp_QueryPROISV;

 TGroupBox *GroupBox1;

 TLabel *sql_Label;

 TAnimate *Animate1;

 TBevel *oper_Bevel;

 TShape *oper_Shape;

 TImage *Image1;

 TQuery *pr_Query;

 TSmallintField *pr_QueryNUM;

 TStringField *pr_QueryDEP;

 TStringField *pr_QueryFAM;

 TStringField *pr_QueryNAM;

 TStringField *pr_QueryPAR;

 TSmallintField *pr_QueryYEAR_B;

 TStringField *pr_QuerySEX;

 TSmallintField *pr_QueryAGE;

 TStoredProc *insert_StoredProc;

 TStoredProc *update_StoredProc;

 TStoredProc *delete_StoredProc;

 TPanel *pr_Panel;

 TLabel *pr_Label;

void __fastcall FormCreate(TObject *Sender);

void __fastcall dp_ComboBoxChange(TObject *Sender);

void __fastcall speedfind_EditChange(TObject *Sender);

void __fastcall pr_QueryCalcFields(TDataSet *DataSet);

void __fastcall pr_QueryAfterScroll(TDataSet *DataSet);

void __fastcall pr_QueryBeforePost(TDataSet *DataSet);

void __fastcall chadd_ButtonClick(TObject *Sender);

void __fastcall chdelete_ButtonClick(TObject *Sender);

void __fastcall chpost_ButtonClick(TObject *Sender);

void __fastcall PageControlChange(TObject *Sender);

 void __fastcall minage_CSpinEditChange(TObject *Sender);

 void __fastcall select_BitBtnClick(TObject *Sender);

 void __fastcall pr_DBGridCellClick(TColumn *Column);

 void __fastcall prview_RadioGroupClick(TObject *Sender);

 void __fastcall pr_DBGridKeyDown(TObject *Sender, WORD &Key,

 TShiftState Shift);

private:// User declarations

public:// User declarations

fastcall Tmain_Form(TComponent* Owner);

 unsigned short Year;

 unsigned short Month;

 unsigned short Day;

 bool CanPost;

 AnsiString sql_Operator;

 void __fastcall Delay(unsigned long int mSeconds);

};

//---------------------------------------------------------------------------

extern PACKAGE Tmain_Form *main_Form;

//---------------------------------------------------------------------------

#endif

Ôàéë Udb.cpp

#include <vcl.h>

#pragma hdrstop

#include "Udb.h"

#pragma package(smart_init)

#pragma link "cspin"

#pragma link "CSPIN"

#pragma resource "*.dfm"

Tmain_Form *main_Form;

fastcall Tmain_Form::Tmain_Form(TComponent* Owner)

 TForm(Owner)

{}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::FormCreate(TObject *Sender)

{

 CanPost = false;

 Date().DecodeDate(&Year,&Month,&Day);

 pr_Query->SQL->Clear();

 sql_Operator = "Select * from PERS order by NUM";

 sql_Label->Caption = sql_Operator;

 pr_Query->SQL->Add(sql_Operator);

 pr_Query->Open();

 pr_Query->First();

 dp_Query->SQL->Clear();

 sql_Operator = "Select * from DEP";

 sql_Label->Caption = sql_Operator;

 dp_Query->SQL->Add(sql_Operator);

 dp_Query->Open();

 dp_Query->First();

 // Çàïîâíåííÿ ComboBox dp_ComboBox òà chdp_ComboBox íàéìóâàííÿìè â³ää³ëê³â

 dp_ComboBox->Clear();

 chdp_ComboBox->Clear();

 while (!dp_Query->Eof) {

 dp_ComboBox->Items->Add(dp_QueryDEP->AsString);

 chdp_ComboBox->Items->Add(dp_QueryDEP->AsString);

 dp_Query->Next();

 }

 dp_ComboBox->Items->Add("óñ³ â³ää³ëêè");

 dp_ComboBox->ItemIndex = dp_ComboBox->Items->Count - 1;

 dp_ComboBoxChange(Sender);

 chdp_ComboBox->ItemIndex = dp_ComboBox->ItemIndex;

 PageControl->ActivePage = find_TabSheet;

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::dp_ComboBoxChange(TObject *Sender)

{

 dp_Query->Close();

 dp_Query->SQL->Clear();

 sql_Operator = "Select * from DEP where DEP=:PDEP";

 sql_Label->Caption = sql_Operator;

 Delay(3000);

 dp_Query->SQL->Add(sql_Operator);

 dp_Query->Params->Items[0]->AsString = dp_ComboBox->Text;

 dp_Query->Open();

 dp_Query->First();

 pr_Query->Close();

 pr_Query->SQL->Clear();

 if (dp_ComboBox->ItemIndex == dp_ComboBox->Items->Count - 1) {

 // ïîêàç âñ³õ çàïèñ³â

 sql_Operator = "Select * from PERS order by NUM";

 sql_Label->Caption = sql_Operator;

 Delay(3000);

 pr_Query->SQL->Add(sql_Operator);

 } else {

 // ïîêàç çàïèñ³â çà ïåðåãëÿäàìè

 sql_Operator =

 "Select * from DEP_" + AnsiString(dp_ComboBox->ItemIndex + 1);

 sql_Label->Caption = sql_Operator;

 Delay(3000);

 pr_Query->SQL->Add(sql_Operator);

 }

 pr_Query->ExecSQL();

 pr_Query->Open();

 pr_Query->First();

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::speedfind_EditChange(TObject *Sender)

{

 TLocateOptions SearchOptions;

 pr_Query->Locate("FAM", speedfind_Edit->Text,

 SearchOptions << loPartialKey << loCaseInsensitive);

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::pr_QueryCalcFields(TDataSet *DataSet)

{

 pr_QueryAGE->Value = Year - pr_QueryYEAR_B->Value;

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::pr_QueryAfterScroll(TDataSet *DataSet)

{

 if (PageControl->ActivePage == TabEdit) {

 // â³äîáðàæåííÿ äàíèõ ïðî ïîòî÷íó ïåðñîíó

 chdp_ComboBox -> ItemIndex =

 chdp_ComboBox->Items->IndexOf(pr_QueryDEP->AsString);

 chfam_Edit->Text = pr_QueryFAM->AsString;

 chname_Edit->Text = pr_QueryNAM->AsString;

 chgrand_Edit->Text = pr_QueryPAR->AsString;

 chyear_CSpinEdit->Value = pr_QueryYEAR_B->AsInteger;

 if (pr_QuerySEX->AsString == "÷") sex2_RadioGroup->ItemIndex = 0;

 else sex2_RadioGroup->ItemIndex = 1;

 }

 pr_Label->Caption = pr_QueryNUM->AsString;

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::pr_QueryBeforePost(TDataSet *DataSet)

{

 if (!CanPost) {

 DataSet->Cancel();

 Abort;

 }

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::chadd_ButtonClick(TObject *Sender)

{ // äîäàâàííÿ çàïèñó äî òàáëèö³ PERS

 insert_StoredProc->ParamByName("pDEP")->AsString = chdp_ComboBox->Text;

 insert_StoredProc->ParamByName("pFAM")->AsString = chfam_Edit->Text;

 insert_StoredProc->ParamByName("pNAM")->AsString = chname_Edit->Text;

 insert_StoredProc->ParamByName("pPAR")->AsString = chgrand_Edit->Text;

 insert_StoredProc->ParamByName("pYEAR_B")->AsInteger = chyear_CSpinEdit->Value;

 insert_StoredProc->ParamByName("pSEX")->AsString =

 sex2_RadioGroup->Items->Strings[sex2_RadioGroup->ItemIndex];

 sql_Operator =

 "Insert into PERS (DEP, FAM, NAM, PAR, YEAR_B, SEX)"

 " VALUES (:pDEP, :pFAM, :pNAM, :pPAR, :pYEAR_B, :pSEX)";

 sql_Label->Caption = sql_Operator;

 insert_StoredProc->Prepare();

 insert_StoredProc->ExecProc();

 dp_ComboBoxChange(Sender);

 ShowMessage ("Âñòàâêó çàïèñó çáåðåæåíîþ ïðîöåäóðîþ INSERTdbP âèêîíàíî óñï³øíî!");

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::chdelete_ButtonClick(TObject *Sender)

{ // âèäàëåííÿ ïîòî÷íîãî çàïèñó ç òàáëèö³ PERS

 if (Application->MessageBox("Âè ä³éñíî áàæàºòå âèäàëèòè ïîòî÷íèé çàïèñ?",

 "ϳäòâåðä³òü âèäàëåííÿ çàïèñó",

 MB_YESNO + MB_ICONEXCLAMATION) == IDYES) {

 delete_StoredProc->ParamByName("pNUM")->AsInteger =

 pr_QueryNUM->AsInteger;

 sql_Operator = "Delete from PERS where NUM = :pNUM";

 sql_Label->Caption = sql_Operator;

 delete_StoredProc->Prepare();

 delete_StoredProc->ExecProc();

 dp_ComboBoxChange(Sender);

 ShowMessage ("Âèäàëåííÿ çàïèñó çáåðåæåíîþ ïðîöåäóðîþ DELETEdbP âèêîíàíî óñï³øíî!");

 }

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::chpost_ButtonClick(TObject *Sender)

{

 update_StoredProc->ParamByName("pDEP")->AsString = chdp_ComboBox->Text;

 update_StoredProc->ParamByName("pFAM")->AsString = chfam_Edit->Text;

 update_StoredProc->ParamByName("pNAM")->AsString = chname_Edit->Text;

 update_StoredProc->ParamByName("pPAR")->AsString = chgrand_Edit->Text;

 update_StoredProc->ParamByName("pYEAR_B")->AsInteger = chyear_CSpinEdit->Value;

 update_StoredProc->ParamByName("pSEX")->AsString =

 sex2_RadioGroup->Items->Strings[sex2_RadioGroup->ItemIndex];

 sql_Operator =

 "Update PERS Set DEP = :pDEP, YEAR_B = :pYEAR_B, SEX = :pSEX "

 " Where (FAM = :pFAM) and (NAM = :pNAM) and (PAR = :pPAR)";

 sql_Label->Caption = sql_Operator;

 update_StoredProc->Prepare();

 update_StoredProc->ExecProc();

 dp_ComboBoxChange(Sender);

 if (update_StoredProc->ParamByName("NUMBER")->AsInteger == 0)

 ShowMessage ("* Ïîìèëêà ïîíîâëåííÿ çàïèñó!");

 else

 ShowMessage ("Ïîíîâëåííÿ çàïèñó çáåðåæåíî.ïðîöåäóðîþ UPDATEdbP âèêîíàíî óñï³øíî!");

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::PageControlChange(TObject *Sender)

{

 if (PageControl->ActivePage == TabEdit)

 pr_QueryAfterScroll(pr_Query);

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::minage_CSpinEditChange(TObject *Sender)

{

 AnsiString s =

 "(YEAR_B<=" + IntToStr(int(Year - minage_CSpinEdit->Value)) +

 ")and(YEAR_B>=" + IntToStr(int(Year - maxage_CSpinEdit->Value)) +

 ")and(SEX=";

 if (!sex_RadioGroup->ItemIndex) s += "'÷')";

 else s += "'æ')";

 // àâòîìàòè÷íå ïîíîâëåííÿ â³äáîðó çàïèñ³â

 select_BitBtn->Kind = bkCancel;

 select_BitBtn->Caption = "³äì³íèòè â³äá³ð";

 pr_Query->Filter = s;

 pr_Query->Filtered = true;

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::select_BitBtnClick(TObject *Sender)

{

 if (pr_Query->Filtered) { // â³äì³íà ðåæèìó ô³ëüòðàö³¿

 pr_Query->Filtered = false;

 select_BitBtn->Kind = bkYes;

 select_BitBtn->Caption = "Ïîíîâèòè â³äá³ð";

 } else { // âñòàíîâëåííÿ ðåæèìó ô³ëüòðàö³¿

 select_BitBtn->Kind = bkCancel;

 select_BitBtn->Caption = "³äì³íèòè â³äá³ð";

 minage_CSpinEditChange(Sender);

 }

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::pr_DBGridCellClick(TColumn *Column)

{

 if (PageControl->ActivePage == TabEdit) {

 chdp_ComboBox -> ItemIndex =

 chdp_ComboBox->Items->IndexOf(pr_QueryDEP->AsString);

 chfam_Edit->Text = pr_QueryFAM->AsString;

 chname_Edit->Text = pr_QueryNAM->AsString;

 chgrand_Edit->Text = pr_QueryPAR->AsString;

 chyear_CSpinEdit->Value = pr_QueryYEAR_B->AsInteger;

 if (pr_QuerySEX->AsString == "÷") sex2_RadioGroup->ItemIndex = 0;

 else sex2_RadioGroup->ItemIndex = 1;

 }

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::Delay(unsigned long int mSeconds)

{ // çàòðèìêà íà äåê³ëüêà ì³ë³ñåêóíä

 unsigned long int FirstTick;

 FirstTick = GetTickCount();

 do

 Application->ProcessMessages();

 while (GetTickCount() - FirstTick <= mSeconds);

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::prview_RadioGroupClick(TObject *Sender)

{

 dp_ComboBoxChange (Sender);

}

//---------------------------------------------------------------------------

void __fastcall Tmain_Form::pr_DBGridKeyDown(TObject *Sender, WORD &Key,

 TShiftState Shift)

{

 pr_Label->Caption = pr_QueryNUM->AsString;

}

//---------------------------------------------------------------------------

Äëÿ âèêîíàííÿ ïðèêëàäåííÿ òðåáà ïîïåðåäíüî çàâàíòàæèòè íà âèêîíàííÿ ïðèêëàäåííÿ-ñåðâåð IBServer.EXE, ÿêå çà çâè÷àé çíàõîäèòüñÿ çà ìàðøðóòîì "E:\Program Files\InterBase Corp\InterBase\Bin\" ³ îáñëóãîâóº çàïèòè äî áàçè äàíèõ Interbase. ϳñëÿ çàâàíòàæåííÿ ïîòî÷-íîãî ïðîåêòó íà âèêîíàííÿ öåé ñåðâåð âèâîäèòü íà åêðàí çàïèò (ìàë.. 1.21) , ó ïîë³ Password: ÿêîãî òðåáà ââåñòè ïàðîëü äîñòóïó masterkey.:

Ìàëþíîê 1.21

Ïðèêëàä âèãëÿäó ôîðìè ï³ä ÷àñ ôóíêö³îíóâàííÿ ïðèêëàäåííÿ íàâåäåíî íà ìàë. 1.22.

 Ìàëþíîê 1.22


Êîíòðîëüíi çàïèòàííÿ:

1. Äåòàëüíî îïèø³òü êîìïîíåíòè RAD: TDataSource, TQuery, TDBMemo, TDBGrid, TDBImage, TDBText, TDBNavigator, TStoredProc.

2. ßê ñòâîðèòè ÁÄ Interbase ³ ïðèçíà÷èòè ¿é àë³àñ?

3. ßê ñòâîðèòè ³íäåêñè òàáëèö³ ÁÄ Interbase?

4. ßê ñòâîðèòè ³ âèêîðèñòàòè ó ïðèêëàäåíí³ ïåðåãëÿä òàáëèö³ ÁÄ Interbase?

5. ßêèì ÷èíîì ñòâîðþºòüñÿ ³ äëÿ ÷îãî âèêîðèñòîâóºòüñÿ ãåíåðàòîð ÁÄ Interbase?

6. ßê ïðèçíà÷èòè çâ’ÿçîê êîìïîíåíò³â ç ðåàëüíîþ ÁÄ?

7. ßêèì ÷èíîì ñòâîðþºòüñÿ ³ äëÿ ÷îãî âèêîðèñòîâóºòüñÿ òðèããåð ÁÄ Interbase?

8. ßêèì ÷èíîì ñòâîðþºòüñÿ ³ äëÿ ÷îãî âèêîðèñòîâóºòüñÿ çáåðåæåíà ïðîöåäóðà ÁÄ Inter-base?

9. Äëÿ ÷îãî âèêîðèñòîâóºòüñÿ îïåðàòîð SQL “SELECT”, íàïðèêëàä:

 "Select * from DEP where DEP=:PDEP"?

10. Îïèø³òü ìåòîäèêó äîäàâàííÿ ³ âèäàëåííÿ çàïèñó äî/ç òàáëèö³ ÁÄ. ×îìó äëÿ öüîãî âèêîðèñòîâóºòüñÿ äîäàòêîâèé êîìïîíåíò TQuery?

11. Îïèø³òü ìåòîäèêó äîäàâàííÿ, âèäàëåííÿ ³ êîðåãóâàííÿ çàïèñ³â òàáëèö³ ÁÄ ³ç âèêîðèñ-òàííÿì çáåðåæåíèõ ïðîöåäóð.

12. Äàéòå äîêëàäí³ ïîÿñíåííÿ äî ðîçðîáëåíî¿ ïðîãðàìè.


Èíôîðìàöèÿ î ðàáîòå «Ïðîåêòóâàííÿ äâîëàíêîâî¿ ðîçïîä³ëåíî¿ ³íôîðìàö³éíî¿ ñèñòåìè äëÿ ðîáîòè ç áàçàìè äàíèõ ³ç âèêîðèñòàííÿì SQL Interbase»
Ðàçäåë: Èíôîðìàòèêà, ïðîãðàììèðîâàíèå
Êîëè÷åñòâî çíàêîâ ñ ïðîáåëàìè: 68745
Êîëè÷åñòâî òàáëèö: 0
Êîëè÷åñòâî èçîáðàæåíèé: 21

0 êîììåíòàðèåâ


Íàâåðõ