Xreferat.com » Рефераты по информатике и программированию » Проектування дволанкової розподіленої інформаційної системи для роботи з базами даних із використанням SQL Interbase

Проектування дволанкової розподіленої інформаційної системи для роботи з базами даних із використанням SQL Interbase

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 FilesInterBase CorpInterBaseBin" і обслуговує запити до бази даних Interbase. Після завантаження поточ-ного проекту на виконання цей сервер виводить на екран запит (мал.. 1.21) , у полі Password: якого треба ввести пароль доступу masterkey.:


Проектування дволанкової розподіленої інформаційної системи для роботи з базами даних із використанням SQL Interbase

Малюнок 1.21


Приклад вигляду форми під час функціонування прикладення наведено на мал. 1.22.

Проектування дволанкової розподіленої інформаційної системи для роботи з базами даних із використанням SQL Interbase

Малюнок 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. Дайте докладні пояснення до розробленої програми.

Если Вам нужна помощь с академической работой (курсовая, контрольная, диплом, реферат и т.д.), обратитесь к нашим специалистам. Более 90000 специалистов готовы Вам помочь.
Бесплатные корректировки и доработки. Бесплатная оценка стоимости работы.

Поможем написать работу на аналогичную тему

Получить выполненную работу или консультацию специалиста по вашему учебному проекту
Нужна помощь в написании работы?
Мы - биржа профессиональных авторов (преподавателей и доцентов вузов). Пишем статьи РИНЦ, ВАК, Scopus. Помогаем в публикации. Правки вносим бесплатно.

Похожие рефераты: