Сеть магазинов по торговле промышленными товарами, страница 4

    PRINT 'Ошибка целостности при добавлении '

  END

 
Приложение II

Текст основной программы

#include <vcl.h>

#pragma hdrstop

#include <stdio.h>

#include "Unit1.h"

#include "Unit3.h"

#include "Unit4.h"

#include "Unit5.h"

#include "Unit6.h"

#pragma package(smart_init)

#pragma resource "*.dfm"

Tform1 *Form1;

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

__fastcall Tform1::Tform1(TComponent* Owner)

        : TForm(Owner)

{

}

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

void __fastcall Tform1::Button1Click(TObject *Sender)

{

Form3->Show();       

}

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

void __fastcall Tform1::Button2Click(TObject *Sender)

{

Form4->Show();       

}

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

void __fastcall Tform1::Button4Click(TObject *Sender)

{

Form5->Show();       

}

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

void __fastcall Tform1::Button4Click(TObject *Sender)

{

Form6->Show();       

}

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

void __fastcall Tform1::Button5Click(TObject *Sender)

{

Form1->Close();       

}

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

#include <vcl.h>

#pragma hdrstop

#include <stdio.h>

#include "Unit3.h"

#pragma package(smart_init)

#pragma resource "*.dfm"

TForm3 *Form3;

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

__fastcall TForm3::TForm3(TComponent* Owner)

        : TForm(Owner)

{

}

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

void __fastcall TForm3::Button1Click(TObject *Sender)

{

char sql[200];

char n1[10];

char n2[10];

char n3[10];

char n4[10];

char n5[10];

Query1->Close();

StrCopy(n1, Edit1->Text.c_str());

StrCopy(n2, Edit2->Text.c_str());

StrCopy(n3, Edit3->Text.c_str());

StrCopy(n4, Edit4->Text.c_str());

sprintf(sql,"EXEC INSERTTOVS @n1=%s, @n2='%s', @n3=%s, @n4='%s' ",n1,n2,n3,n4);

Query1->SQL->Clear();

Query1->SQL->Add(sql);

try

{

Query1->Open();

 }

catch (...)

 { }

}

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

void __fastcall TForm3::Button2Click(TObject *Sender)

{

char sql[200];

char n1[10];

char n2[10];

char n3[10];

char n4[10];

char n5[10];

char n6[10];

Query1->Close();

StrCopy(n1, Edit5->Text.c_str());

StrCopy(n2, Edit6->Text.c_str());

StrCopy(n3, Edit7->Text.c_str());

StrCopy(n4, Edit8->Text.c_str());

StrCopy(n6, Edit9->Text.c_str());

sprintf(sql,"EXEC INSERTTOVM @n1=%s, @n2=%s, @n3='%s',@n4=%s, @n5='%s'",n1,n2,n3,n4,n5);

Query1->SQL->Clear();

Query1->SQL->Add(sql);

try

{

Query1->Open();

}

catch (...)

 { }       

}

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

void __fastcall TForm3::Button3Click(TObject *Sender)

{

char sql[200];

char n1[10];

char n2[10];

char n3[10];

char n4[10];

char n5[10];

Query1->Close();

StrCopy(n1, Edit10->Text.c_str());

StrCopy(n2, Edit11->Text.c_str());

StrCopy(n3, Edit12->Text.c_str());

StrCopy(n4, Edit13->Text.c_str());

StrCopy(n5, Edit14->Text.c_str());

sprintf(sql,"EXEC INSERTMAGAZIN @n1=%s, @n2='%s', @n3='%s',@n4=%s, @n5='%s'",n1,n2,n3,n4,n5);

Query1->SQL->Clear();

Query1->SQL->Add(sql);

try

{

Query1->Open();

}

catch (...)

 {

 }       

}

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

void __fastcall TForm3::Button4Click(TObject *Sender)

{

char sql[200];

char n1[20];

char n2[10];

char n3[10];

char n4[10];

char n5[10];

Query1->Close();

StrCopy(n1,Edit15->Text.c_str());

StrCopy(n2,Edit16->Text.c_str());

StrCopy(n3,Edit17->Text.c_str());

StrCopy(n4,Edit18->Text.c_str());

StrCopy(n5,Edit19->Text.c_str());

sprintf(sql,"EXEC INSERTSOTRUDNIK @n1='%s', @n2='%s', @n3='%s',@n4=%s,@n5='%s'",n1,n2,n3,n4,n5);

Query1->SQL->Clear();

Query1->SQL->Add(sql);

try

{

Query1->Open();

}

catch (...)

 { }

}

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

void __fastcall TForm3::Button5Click(TObject *Sender)

{

char sql[200];

char n1[20];

char n2[10];

char n3[10];

char n4[10];

char n5[10];

char n6[10];

Query1->Close();

StrCopy(n1,Edit20->Text.c_str());

StrCopy(n2,Edit21->Text.c_str());

StrCopy(n3,Edit22->Text.c_str());

StrCopy(n4,Edit23->Text.c_str());

StrCopy(n5,Edit24->Text.c_str());

StrCopy(n6,Edit25->Text.c_str());

sprintf(sql,"EXEC INSERTZAKAZ @n1='%s', @n2=%s, @n3='%s',@n4=%s,@n5='%s',@n6=%s",n1,n2,n3,n4,n5,n6);

Query1->SQL->Clear();

Query1->SQL->Add(sql);

try

{

Query1->Open();

}

catch (...)

 { }

}

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

void __fastcall TForm3::Button6Click(TObject *Sender)

{ char sql[200];

Query1->Close();

sprintf(sql,"SELECT * FROM TovS");

Query1->SQL->Clear();

Query1->SQL->Add(sql);

MessageBox(NULL,sql, "SQL", MB_OK);

try

{

Query1->Open();

}

catch (...)

 { }

}

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

void __fastcall TForm3::Button7Click(TObject *Sender)

{

Edit1->Text="";

Edit2->Text="";

Edit3->Text="";

Edit4->Text="";

}

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