9-ma’ruza. Vizual muhitning ma’lumotlar bazasiga ulanish jarayonlarini dasturlash


-rasm. Ma'lumotlar bazasidagi jadval elementlari va ma'lumotlar to'plamidagi


Download 1.6 Mb.
Pdf ko'rish
bet8/8
Sana17.12.2022
Hajmi1.6 Mb.
#1026012
1   2   3   4   5   6   7   8
Bog'liq
.trashed-1673542693-9-ma’ruza. Vizual muhitning ma’lumotlar bazasiga ulanish jarayonlarini dasturlash

12.25-rasm. Ma'lumotlar bazasidagi jadval elementlari va ma'lumotlar to'plamidagi 
jadval o'rtasidagi yozishmalar jadvali 
 
Kompilyatsiya qilishdan oldin forma shakli 12.26-rasmda ko'rsatilgan. Biz  
tugmachasini bosib dasturni kompilyatsiya qilamiz. Kompilyatsiya muvaffaqiyatli bo'ldi. Ilovani 
tugmasi bilan bajarish uchun ishga tushiring. Shaklning kompilyatsiya va bajarilgandan 
keyingi ko'rinishi 12.27-rasmda ko'rsatilgan. 
Ma'lumotlarni ma'lumotlar bazasidan jadvalga yuklash tugmasini bosing. Natija 12. 28-
rasmda ko'rsatilgan. 
Keling, qatorlar o'chirilganligini, qatorlar qo'shilganligini, ba'zi qator maydonlarining 
qiymatlari o'zgartirilganligini va nihoyat tuzatilgan jadval ma'lumotlar bazasiga qaytarilganligini 
tekshirib ko'raylik. Ushbu harakatlarning natijalari 12.29 va 12.30-rasmlarda ko'rsatilgan. 


Ilova qator qo'shish rejimida sinovdan o'tkazilganda (bu Navigatorning "Plus" tugmasi 
yordamida amalga oshirildi, bu maydon ma'lumotlari kiritiladigan bo'sh qatorni yaratadi), 
dasturlash muhiti qator kalitini ko'rsatishni talab qildi, ya'ni 1-ustun ustunidagi maydon qiymati. 
Bu juda noqulay, chunki jadvalda ko'p qatorlar mavjud bo'lganda kalit maydonning qiymatini 
yagona tanlash qiyin. Ma'lum bo'lishicha, bu muammodan chiqishning yo'li bor. DataSetda jadval 
ustunlarining xossalarini ochishingiz va Column1 kalit maydoni uchun AutoIncrement 
xususiyatini (avtomatik bir marta oshirish) False dan true ga o'zgartirishingiz kerak (12.31-rasm). 
Yuqoridagi yechimni amalga oshiradigan dastur 12-2 ro'yxatda ko'rsatilgan. 
12.26-rasm. Formaning kompilyatsiya qilishdan oldin ko'rinishi 
12.27-rasm. Formani kompilyatsiya qilish va bajarishdan keyingi ko'rinishi 


12.28-rasm. Ma'lumotlar bazasidan "Mualliflar" jadvalini yuklash 
12.29-rasm. Xotirada (ekranda) "Mualliflar" jadvali tuzatildi va ma'lumotlar bazasiga 
qaytarildi 


12.30-rasm. "Mualliflar" jadvalini qayta o'qish 
12.31-rasm. Jadval kaliti maydoniga avtomatik oshirish xususiyatini berish 
#pragma once 
namespace db2011длягл122 { 
using namespace System; 
using namespace System::ComponentModel; 
using namespace System::Collections; 
using namespace System::Windows::Forms; 
using namespace System::Data; 
using namespace System::Drawing; 
///  
/// Summary for Form1 
///
 
public ref class Form1 : public System::Windows::Forms::Form 

public: 
Form1(void) 

InitializeComponent(); 
// 
//TODO: Add the constructor code here 


// 

protected: 
///  
/// Clean up any resources being used. 
///
 
~Form1() 

if (components) 

delete components


private: System::Data::OleDb::OleDbCommand^ oleDbSelectCommand1; 
protected: 
private: System::Data::OleDb::OleDbCommand^ oleDbInsertCommand1; 
private: System::Data::OleDb::OleDbCommand^ oleDbUpdateCommand1; 
private: System::Data::OleDb::OleDbCommand^ oleDbDeleteCommand1; 
private: System::Data::OleDb::OleDbDataAdapter^ oleDbDataAdapter1; 
private: System::Data::OleDb::OleDbConnection^ oleDbConnection1; 
private: System::Windows::Forms::BindingSource^ bindingSource1; 
private: System::Data::DataSet^ dataSet1; 
private: System::Data::DataTable^ dataTable1; 
private: System::Data::DataColumn^ dataColumn1; 
private: System::Data::DataColumn^ dataColumn2; 
private: System::Data::DataColumn^ dataColumn3; 
private: System::Data::DataColumn^ dataColumn4; 
private: System::Data::DataColumn^ dataColumn5; 
private: System::Data::DataColumn^ dataColumn6; 
private: System::Windows::Forms::BindingNavigator^ bindingNavigator1; 
private: System::Windows::Forms::ToolStripButton^ 
bindingNavigatorAddNewItem; 
private: System::Windows::Forms::ToolStripLabel^ bindingNavigatorCountItem; 
private: System::Windows::Forms::ToolStripButton^ 
bindingNavigatorDeleteItem; 
private: System::Windows::Forms::ToolStripButton^ 
bindingNavigatorMoveFirstItem; 
private: System::Windows::Forms::ToolStripButton^ 
bindingNavigatorMovePreviousItem; 
private: System::Windows::Forms::ToolStripSeparator^ 
bindingNavigatorSeparator; 
private: System::Windows::Forms::ToolStripTextBox^ 
bindingNavigatorPositionItem; 
private: System::Windows::Forms::ToolStripSeparator^ 
bindingNavigatorSeparator1; 
private: System::Windows::Forms::ToolStripButton^ 


bindingNavigatorMoveNextItem; 
private: System::Windows::Forms::ToolStripButton^ 
bindingNavigatorMoveLastItem; 
private: System::Windows::Forms::ToolStripSeparator^ 
bindingNavigatorSeparator2; 
private: System::Windows::Forms::Button^ button1; 
private: System::Windows::Forms::DataGridView^ dataGridView1; 
private: System::Windows::Forms::Button^ button2; 
private: System::Windows::Forms::Button^ button3; 
private: System::Windows::Forms::DataGridViewTextBoxColumn^ Column1; 
private: System::Windows::Forms::DataGridViewTextBoxColumn^ 
column2DataGridViewTextBoxColumn; 
private: System::Windows::Forms::DataGridViewTextBoxColumn^ 
column3DataGridViewTextBoxColumn; 
private: System::Windows::Forms::DataGridViewTextBoxColumn^ 
column4DataGridViewTextBoxColumn; 
private: System::Windows::Forms::DataGridViewTextBoxColumn^ 
column5DataGridViewTextBoxColumn; 
private: System::Windows::Forms::DataGridViewTextBoxColumn^ 
column6DataGridViewTextBoxColumn; 
private: System::ComponentModel::IContainer^ components; 
private: 
///  
/// Required designer variable. 
///
 
#pragma region Windows Form Designer generated code 
///  
/// Required method for Designer support — do not modify 
/// the contents of this method with the code editor. 
/// 
 
void InitializeComponent(void) 

this->components = (gcnew System::ComponentModel::Container()); 
System::ComponentModel::ComponentResourceManager^ resources = (gcnew 
System::ComponentModel::ComponentResourceManager(Form1::typeid)); 
this->oleDbSelectCommand1 = (gcnew 
System::Data::OleDb::OleDbCommand()); 
this->oleDbConnection1 = (gcnew 
System::Data::OleDb::OleDbConnection()); 
this->oleDbInsertCommand1 = (gcnew 
System::Data::OleDb::OleDbCommand()); 
this->oleDbUpdateCommand1 = (gcnew 
System::Data::OleDb::OleDbCommand()); 
this->oleDbDeleteCommand1 = (gcnew 
System::Data::OleDb::OleDbCommand()); 
this->oleDbDataAdapter1 = (gcnew 


System::Data::OleDb::OleDbDataAdapter()); 
this->bindingSource1 = (gcnew 
System::Windows::Forms::BindingSource(this->components)); 
this->dataSet1 = (gcnew System::Data::DataSet()); 
this->dataTable1 = (gcnew System::Data::DataTable()); 
this->dataColumn1 = (gcnew System::Data::DataColumn()); 
this->dataColumn2 = (gcnew System::Data::DataColumn()); 
this->dataColumn3 = (gcnew System::Data::DataColumn()); 
this->dataColumn4 = (gcnew System::Data::DataColumn()); 
this->dataColumn5 = (gcnew System::Data::DataColumn()); 
this->dataColumn6 = (gcnew System::Data::DataColumn()); 
this->bindingNavigator1 = (gcnew 
System::Windows::Forms::BindingNavigator(this->components)); 
this->bindingNavigatorAddNewItem = (gcnew 
System::Windows::Forms::ToolStripButton()); 
this->bindingNavigatorCountItem = (gcnew 
System::Windows::Forms::ToolStripLabel()); 
this->bindingNavigatorDeleteItem = (gcnew 
System::Windows::Forms::ToolStripButton()); 
this->bindingNavigatorMoveFirstItem = (gcnew 
System::Windows::Forms::ToolStripButton()); 
this->bindingNavigatorMovePreviousItem = (gcnew 
System::Windows::Forms::ToolStripButton()); 
this->bindingNavigatorSeparator = (gcnew 
System::Windows::Forms::ToolStripSeparator()); 
this->bindingNavigatorPositionItem = (gcnew 
System::Windows::Forms::ToolStripTextBox()); 
this->bindingNavigatorSeparator1 = (gcnew 
System::Windows::Forms::ToolStripSeparator()); 
this->bindingNavigatorMoveNextItem = (gcnew 
System::Windows::Forms::ToolStripButton()); 
this->bindingNavigatorMoveLastItem = (gcnew 
System::Windows::Forms::ToolStripButton()); 
this->bindingNavigatorSeparator2 = (gcnew 
System::Windows::Forms::ToolStripSeparator()); 
this->button1 = (gcnew System::Windows::Forms::Button()); 
this->dataGridView1 = (gcnew System::Windows::Forms::DataGridView()); 
this->button2 = (gcnew System::Windows::Forms::Button()); 
this->button3 = (gcnew System::Windows::Forms::Button()); 
this->Column1 = (gcnew 
System::Windows::Forms::DataGridViewTextBoxColumn()); 
this->column2DataGridViewTextBoxColumn = (gcnew 
System::Windows::Forms::DataGridViewTextBoxColumn()); 
this->column3DataGridViewTextBoxColumn = (gcnew 
System::Windows::Forms::DataGridViewTextBoxColumn()); 
this->column4DataGridViewTextBoxColumn = (gcnew 


System::Windows::Forms::DataGridViewTextBoxColumn()); 
this->column5DataGridViewTextBoxColumn = (gcnew 
System::Windows::Forms::DataGridViewTextBoxColumn()); 
this->column6DataGridViewTextBoxColumn = (gcnew 
System::Windows::Forms::DataGridViewTextBoxColumn()); 
(cli::safe_cast(this- 
>bindingSource1))->BeginInit(); 
(cli::safe_cast(this- 
>dataSet1))->BeginInit(); 
(cli::safe_cast(this- 
>dataTable1))->BeginInit(); 
(cli::safe_cast(this- 
>bindingNavigator1))->BeginInit(); 
this->bindingNavigator1->SuspendLayout(); 
(cli::safe_cast(this- 
>dataGridView1))->BeginInit(); 
this->SuspendLayout(); 
// 
// oleDbSelectCommand1 
// 
this->oleDbSelectCommand1->CommandText = L"SELECT Авторы.*\r\nFROM 
Авторы"; 
this->oleDbSelectCommand1->Connection = this->oleDbConnection1; 
// 
// oleDbConnection1 
// 
this->oleDbConnection1->ConnectionString = 
L"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\"D:\\База данных 
MSAccess\\MSAccess-" 
L"2000\\Database1.mdb\""; 
// 
// oleDbInsertCommand1 
// 
this->oleDbInsertCommand1->CommandText = L"INSERT INTO `Авторы` 
(`Поле1`, `Поле2`, `Поле3`, `Поле4`, `Поле5`) VALUES (\?, \?, " 
L"\?, \?, \?)"; 
this->oleDbInsertCommand1->Connection = this->oleDbConnection1; 
this->oleDbInsertCommand1->Parameters->AddRange(gcnew cli::array< 
System::Data::OleDb::OleDbParameter^ >(5) {(gcnew 
System::Data::OleDb::OleDbParameter(L"Поле1", 
System::Data::OleDb::OleDbType::VarWChar, 0, L"Поле1")), (gcnew 
System::Data::OleDb::OleDbParameter(L"Поле2", 
System::Data::OleDb::OleDbType::VarWChar, 
0, L"Поле2")), (gcnew 
System::Data::OleDb::OleDbParameter(L"Поле3", 
System::Data::OleDb::OleDbType::VarWChar, 0, L"Поле3")), 


(gcnew System::Data::OleDb::OleDbParameter(L"Поле4", 
System::Data::OleDb::OleDbType::VarWChar, 0, L"Поле4")), (gcnew 
System::Data::OleDb::OleDbParameter(L"Поле5", 
System::Data::OleDb::OleDbType::VarWChar, 0, L"Поле5"))}); 
// 
// oleDbUpdateCommand1 
// 
this->oleDbUpdateCommand1->CommandText = resources- 
>GetString(L"oleDbUpdateCommand1.CommandText"); 
this->oleDbUpdateCommand1->Connection = this->oleDbConnection1; 
this->oleDbUpdateCommand1->Parameters->AddRange(gcnew cli::array< 
System::Data::OleDb::OleDbParameter^ >(16) {(gcnew 
System::Data::OleDb::OleDbParameter(L"Поле1", 
System::Data::OleDb::OleDbType::VarWChar, 0, L"Поле1")), (gcnew 
System::Data::OleDb::OleDbParameter(L"Поле2", 
System::Data::OleDb::OleDbType::VarWChar, 
0, L"Поле2")), (gcnew 
System::Data::OleDb::OleDbParameter(L"Поле3", 
System::Data::OleDb::OleDbType::VarWChar, 0, L"Поле3")), 
(gcnew System::Data::OleDb::OleDbParameter(L"Поле4", 
System::Data::OleDb::OleDbType::VarWChar, 0, L"Поле4")), (gcnew 
System::Data::OleDb::OleDbParameter(L"Поле5", 
System::Data::OleDb::OleDbType::VarWChar, 0, L"Поле5")), (gcnew 
System::Data::OleDb::OleDbParameter(L"Original_Код", 
System::Data::OleDb::OleDbType::Integer, 
0, System::Data::ParameterDirection::Input, false, 
static_cast(0), static_cast(0), L"Код", 
System::Data::DataRowVersion::Original, 
nullptr)), (gcnew 
System::Data::OleDb::OleDbParameter(L"IsNull_Поле1", 
System::Data::OleDb::OleDbType::Integer, 0, 
System::Data::ParameterDirection::Input, 
static_cast(0), static_cast(0), 
L"Поле1", System::Data::DataRowVersion::Original, true, nullptr)), 
(gcnew System::Data::OleDb::OleDbParameter(L"Original_Поле1", 
System::Data::OleDb::OleDbType::VarWChar, 0, 
System::Data::ParameterDirection::Input, 
false, static_cast(0), 
static_cast(0), L"Поле1", System::Data::DataRowVersion::Original, 
nullptr)), 
(gcnew System::Data::OleDb::OleDbParameter(L"IsNull_Поле2", 
System::Data::OleDb::OleDbType::Integer, 0, 
System::Data::ParameterDirection::Input, 
static_cast(0), static_cast(0), 
L"Поле2", System::Data::DataRowVersion::Original, true, nullptr)), 
(gcnew System::Data::OleDb::OleDbParameter(L"Original_Поле2", 


System::Data::OleDb::OleDbType::VarWChar, 0, 
System::Data::ParameterDirection::Input, 
false, static_cast(0), 
static_cast(0), L"Поле2", System::Data::DataRowVersion::Original, 
nullptr)), 
(gcnew System::Data::OleDb::OleDbParameter(L"IsNull_Поле3", 
System::Data::OleDb::OleDbType::Integer, 0, 
System::Data::ParameterDirection::Input, 
static_cast(0), static_cast(0), 
L"Поле3", System::Data::DataRowVersion::Original, true, nullptr)), 
(gcnew System::Data::OleDb::OleDbParameter(L"Original_Поле3", 
System::Data::OleDb::OleDbType::VarWChar, 0, 
System::Data::ParameterDirection::Input, 
false, static_cast(0), 
static_cast(0), L"Поле3", System::Data::DataRowVersion::Original, 
nullptr)), 
(gcnew System::Data::OleDb::OleDbParameter(L"IsNull_Поле4", 
System::Data::OleDb::OleDbType::Integer, 0, 
System::Data::ParameterDirection::Input, 
static_cast(0), static_cast(0), 
L"Поле4", System::Data::DataRowVersion::Original, true, nullptr)), 
(gcnew System::Data::OleDb::OleDbParameter(L"Original_Поле4", 
System::Data::OleDb::OleDbType::VarWChar, 0, 
System::Data::ParameterDirection::Input, 
false, static_cast(0), 
static_cast(0), L"Поле4", System::Data::DataRowVersion::Original, 
nullptr)), 
(gcnew System::Data::OleDb::OleDbParameter(L"IsNull_Поле5", 
System::Data::OleDb::OleDbType::Integer, 0, 
System::Data::ParameterDirection::Input, 
static_cast(0), static_cast(0), 
L"Поле5", System::Data::DataRowVersion::Original, true, nullptr)), 
(gcnew System::Data::OleDb::OleDbParameter(L"Original_Поле5", 
System::Data::OleDb::OleDbType::VarWChar, 0, 
System::Data::ParameterDirection::Input, 
false, static_cast(0), 
static_cast(0), L"Поле5", System::Data::DataRowVersion::Original, 
nullptr))}); 
// 
// oleDbDeleteCommand1 
// 
this->oleDbDeleteCommand1->CommandText = resources- 
>GetString(L"oleDbDeleteCommand1.CommandText"); 
this->oleDbDeleteCommand1->Connection = this->oleDbConnection1; 
this->oleDbDeleteCommand1->Parameters->AddRange(gcnew cli::array< 
System::Data::OleDb::OleDbParameter^ >(11) {(gcnew 


System::Data::OleDb::OleDbParameter(L"Original_Код", 
System::Data::OleDb::OleDbType::Integer, 0, 
System::Data::ParameterDirection::Input, false, static_cast(0), 
static_cast(0), L"Код", 
System::Data::DataRowVersion::Original, nullptr)), (gcnew 
System::Data::OleDb::OleDbParameter(L"IsNull_Поле1", 
System::Data::OleDb::OleDbType::Integer, 0, 
System::Data::ParameterDirection::Input, static_cast(0), 
static_cast(0), 
L"Поле1", System::Data::DataRowVersion::Original, true, 
nullptr)), (gcnew System::Data::OleDb::OleDbParameter(L"Original_Поле1", 
System::Data::OleDb::OleDbType::VarWChar, 0, 
System::Data::ParameterDirection::Input, false, static_cast(0), 
static_cast(0), L"Поле1", 
System::Data::DataRowVersion::Original, nullptr)), (gcnew 
System::Data::OleDb::OleDbParameter(L"IsNull_Поле2", 
System::Data::OleDb::OleDbType::Integer, 0, 
System::Data::ParameterDirection::Input, static_cast(0), 
static_cast(0), 
L"Поле2", System::Data::DataRowVersion::Original, true, 
nullptr)), (gcnew System::Data::OleDb::OleDbParameter(L"Original_Поле2", 
System::Data::OleDb::OleDbType::VarWChar, 0, 
System::Data::ParameterDirection::Input, false, static_cast(0), 
static_cast(0), L"Поле2", 
System::Data::DataRowVersion::Original, nullptr)), (gcnew 
System::Data::OleDb::OleDbParameter(L"IsNull_Поле3", 
System::Data::OleDb::OleDbType::Integer, 0, 
System::Data::ParameterDirection::Input, static_cast(0), 
static_cast(0), 
L"Поле3", System::Data::DataRowVersion::Original, true, 
nullptr)), (gcnew System::Data::OleDb::OleDbParameter(L"Original_Поле3", 
System::Data::OleDb::OleDbType::VarWChar, 0, 
System::Data::ParameterDirection::Input, false, static_cast(0), 
static_cast(0), L"Поле3", 
System::Data::DataRowVersion::Original, nullptr)), (gcnew 
System::Data::OleDb::OleDbParameter(L"IsNull_Поле4", 
System::Data::OleDb::OleDbType::Integer, 0, 
System::Data::ParameterDirection::Input, static_cast(0), 
static_cast(0), 
L"Поле4", System::Data::DataRowVersion::Original, true, 
nullptr)), (gcnew System::Data::OleDb::OleDbParameter(L"Original_Поле4", 
System::Data::OleDb::OleDbType::VarWChar, 0, 
System::Data::ParameterDirection::Input, false, static_cast(0), 
static_cast(0), L"Поле4", 
System::Data::DataRowVersion::Original, nullptr)), (gcnew 
System::Data::OleDb::OleDbParameter(L"IsNull_Поле5", 


System::Data::OleDb::OleDbType::Integer, 0, 
System::Data::ParameterDirection::Input, static_cast(0), 
static_cast(0), 
L"Поле5", System::Data::DataRowVersion::Original, true, 
nullptr)), (gcnew System::Data::OleDb::OleDbParameter(L"Original_Поле5", 
System::Data::OleDb::OleDbType::VarWChar, 0, 
System::Data::ParameterDirection::Input, false, static_cast(0), 
static_cast(0), L"Поле5", 
System::Data::DataRowVersion::Original, nullptr))}); 
// 
// oleDbDataAdapter1 
// 
this->oleDbDataAdapter1->DeleteCommand = this->oleDbDeleteCommand1; 
this->oleDbDataAdapter1->InsertCommand = this->oleDbInsertCommand1; 
this->oleDbDataAdapter1->SelectCommand = this->oleDbSelectCommand1; 
cli::array< System::Data::Common::DataColumnMapping^ >^ __mcTemp__1 = 
gcnew cli::array< System::Data::Common::DataColumnMapping^ >(6) {(gcnew 
System::Data::Common::DataColumnMapping(L"Код", 
L"Column1")), (gcnew 
System::Data::Common::DataColumnMapping(L"Поле1", L"Column2")), (gcnew 
System::Data::Common::DataColumnMapping(L"Поле2", 
L"Column3")), (gcnew 
System::Data::Common::DataColumnMapping(L"Поле3", L"Column4")), (gcnew 
System::Data::Common::DataColumnMapping(L"Поле4", 
L"Column5")), (gcnew 
System::Data::Common::DataColumnMapping(L"Поле5", L"Column6"))}; 
this->oleDbDataAdapter1->TableMappings->AddRange(gcnew cli::array< 
System::Data::Common::DataTableMapping^ >(1) {(gcnew 
System::Data::Common::DataTableMapping(L"Table", 
L"Авторы", __mcTemp__1))}); 
this->oleDbDataAdapter1->UpdateCommand = this->oleDbUpdateCommand1; 
// 
// bindingSource1 
// 
this->bindingSource1->DataMember = L"Авторы"; 
this->bindingSource1->DataSource = this->dataSet1; 
this->bindingSource1->Sort = L"Column2"; 
// 
// dataSet1 
// 
this->dataSet1->DataSetName = L"NewDataSet"; 
this->dataSet1->Tables->AddRange(gcnew cli::array< 
System::Data::DataTable^ >(1) {this->dataTable1}); 
// 
// dataTable1 
// 


this->dataTable1->Columns->AddRange(gcnew cli::array< 
System::Data::DataColumn^ >(6) {this->dataColumn1, this->dataColumn2, 
this->dataColumn3, this->dataColumn4, this->dataColumn5, this- 
>dataColumn6}); 
cli::array< System::String^ >^ __mcTemp__2 = gcnew cli::array< 
System::String^ >(1) {L"Column1"}; 
this->dataTable1->Constraints->AddRange(gcnew cli::array< 
System::Data::Constraint^ >(1) {(gcnew 
System::Data::UniqueConstraint(L"Constraint1", 
__mcTemp__2, true))}); 
this->dataTable1->PrimaryKey = gcnew cli::array< 
System::Data::DataColumn^ >(1) {this->dataColumn1}; 
this->dataTable1->TableName = L"Авторы"; 
// 
// dataColumn1 
// 
this->dataColumn1->AllowDBNull = false; 
this->dataColumn1->AutoIncrement = true; 
this->dataColumn1->ColumnName = L"Column1"; 
this->dataColumn1->DataType = System::Int64::typeid; 
// 
// dataColumn2 
// 
this->dataColumn2->ColumnName = L"Column2"; 
// 
// dataColumn3 
// 
this->dataColumn3->ColumnName = L"Column3"; 
// 
// dataColumn4 
// 
this->dataColumn4->ColumnName = L"Column4"; 
// 
// dataColumn5 
// 
this->dataColumn5->ColumnName = L"Column5"; 
// 
// dataColumn6 
// 
this->dataColumn6->ColumnName = L"Column6"; 
// 
// bindingNavigator1 
// 
this->bindingNavigator1->AddNewItem = this- 
>bindingNavigatorAddNewItem; 
this->bindingNavigator1->BindingSource = this->bindingSource1; 


this->bindingNavigator1->CountItem = this->bindingNavigatorCountItem; 
this->bindingNavigator1->DeleteItem = this- 
>bindingNavigatorDeleteItem; 
this->bindingNavigator1->Items->AddRange(gcnew cli::array< 
System::Windows::Forms::ToolStripItem^ >(11) {this- 
>bindingNavigatorMoveFirstItem, 
this->bindingNavigatorMovePreviousItem, this- 
>bindingNavigatorSeparator, this->bindingNavigatorPositionItem, this- 
>bindingNavigatorCountItem, 
this->bindingNavigatorSeparator1, this- 
>bindingNavigatorMoveNextItem, this->bindingNavigatorMoveLastItem, this- 
>bindingNavigatorSeparator2, 
this->bindingNavigatorAddNewItem, this- 
>bindingNavigatorDeleteItem}); 
this->bindingNavigator1->Location = System::Drawing::Point(0, 0); 
this->bindingNavigator1->MoveFirstItem = this- 
>bindingNavigatorMoveFirstItem; 
this->bindingNavigator1->MoveLastItem = this- 
>bindingNavigatorMoveLastItem; 
this->bindingNavigator1->MoveNextItem = this- 
>bindingNavigatorMoveNextItem; 
this->bindingNavigator1->MovePreviousItem = this- 
>bindingNavigatorMovePreviousItem; 
this->bindingNavigator1->Name = L"bindingNavigator1"; 
this->bindingNavigator1->PositionItem = this- 
>bindingNavigatorPositionItem; 
this->bindingNavigator1->Size = System::Drawing::Size(654, 27); 
this->bindingNavigator1->TabIndex = 1; 
this->bindingNavigator1->Text = L"bindingNavigator1"; 
// 
// bindingNavigatorAddNewItem 
// 
this->bindingNavigatorAddNewItem->DisplayStyle = 
System::Windows::Forms::ToolStripItemDisplayStyle::Image; 
this->bindingNavigatorAddNewItem->Image = 
(cli::safe_cast(resources- 
>GetObject(L"bindingNavigatorAddNewItem.Image"))); 
this->bindingNavigatorAddNewItem->Name = 
L"bindingNavigatorAddNewItem"; 
this->bindingNavigatorAddNewItem->RightToLeftAutoMirrorImage = true; 
this->bindingNavigatorAddNewItem->Size = System::Drawing::Size(23, 24); 
this->bindingNavigatorAddNewItem->Text = L"Add new"; 
// 
// bindingNavigatorCountItem 
// 
this->bindingNavigatorCountItem->Name = L"bindingNavigatorCountItem"; 


this->bindingNavigatorCountItem->Size = System::Drawing::Size(45, 24); 
this->bindingNavigatorCountItem->Text = L"of {0}"; 
this->bindingNavigatorCountItem->ToolTipText = L"Total number of items"; 
// 
// bindingNavigatorDeleteItem 
// 
this->bindingNavigatorDeleteItem->DisplayStyle = 
System::Windows::Forms::ToolStripItemDisplayStyle::Image; 
this->bindingNavigatorDeleteItem->Image = 
(cli::safe_cast(resources- 
>GetObject(L"bindingNavigatorDeleteItem.Image"))); 
this->bindingNavigatorDeleteItem->Name = 
L"bindingNavigatorDeleteItem"; 
this->bindingNavigatorDeleteItem->RightToLeftAutoMirrorImage = true; 
this->bindingNavigatorDeleteItem->Size = System::Drawing::Size(23, 24); 
this->bindingNavigatorDeleteItem->Text = L"Delete"; 
// 
// bindingNavigatorMoveFirstItem 
// 
this->bindingNavigatorMoveFirstItem->DisplayStyle = 
System::Windows::Forms::ToolStripItemDisplayStyle::Image; 
this->bindingNavigatorMoveFirstItem->Image = 
(cli::safe_cast(resources- 
>GetObject(L"bindingNavigatorMoveFirstItem.Image"))); 
this->bindingNavigatorMoveFirstItem->Name = 
L"bindingNavigatorMoveFirstItem"; 
this->bindingNavigatorMoveFirstItem->RightToLeftAutoMirrorImage = 
true; 
this->bindingNavigatorMoveFirstItem->Size = System::Drawing:: 
Size(23, 24); 
this->bindingNavigatorMoveFirstItem->Text = L"Move first"; 
// 
// bindingNavigatorMovePreviousItem 
// 
this->bindingNavigatorMovePreviousItem->DisplayStyle = 
System::Windows::Forms::ToolStripItemDisplayStyle::Image; 
this->bindingNavigatorMovePreviousItem->Image = 
(cli::safe_cast(resources- 
>GetObject(L"bindingNavigatorMovePreviousItem.Image"))); 
this->bindingNavigatorMovePreviousItem->Name = 
L"bindingNavigatorMovePreviousItem"; 
this->bindingNavigatorMovePreviousItem->RightToLeftAutoMirrorImage = 
true; 
this->bindingNavigatorMovePreviousItem->Size = 
System::Drawing::Size(23, 24); 
this->bindingNavigatorMovePreviousItem->Text = L"Move previous"; 


// 
// bindingNavigatorSeparator 
// 
this->bindingNavigatorSeparator->Name = L"bindingNavigatorSeparator"; 
this->bindingNavigatorSeparator->Size = System::Drawing::Size(6, 27); 
// 
// bindingNavigatorPositionItem 
// 
this->bindingNavigatorPositionItem->AccessibleName = L"Position"; 
this->bindingNavigatorPositionItem->AutoSize = false; 
this->bindingNavigatorPositionItem->Name = 
L"bindingNavigatorPositionItem"; 
this->bindingNavigatorPositionItem->Size = System::Drawing::Size(50, 27); 
this->bindingNavigatorPositionItem->Text = L"0"; 
this->bindingNavigatorPositionItem->ToolTipText = L"Current position"; 
// 
// bindingNavigatorSeparator1 
// 
this->bindingNavigatorSeparator1->Name = 
L"bindingNavigatorSeparator1"; 
this->bindingNavigatorSeparator1->Size = System::Drawing::Size(6, 27); 
// 
// bindingNavigatorMoveNextItem 
// 
this->bindingNavigatorMoveNextItem->DisplayStyle = 
System::Windows::Forms::ToolStripItemDisplayStyle::Image; 
this->bindingNavigatorMoveNextItem->Image = 
(cli::safe_cast(resources- 
>GetObject(L"bindingNavigatorMoveNextItem.Image"))); 
this->bindingNavigatorMoveNextItem->Name = 
L"bindingNavigatorMoveNextItem"; 
this->bindingNavigatorMoveNextItem->RightToLeftAutoMirrorImage = true; 
this->bindingNavigatorMoveNextItem->Size = System::Drawing::Size(23, 24); 
this->bindingNavigatorMoveNextItem->Text = L"Move next"; 
// 
// bindingNavigatorMoveLastItem 
// 
this->bindingNavigatorMoveLastItem->DisplayStyle = 
System::Windows::Forms::ToolStripItemDisplayStyle::Image; 
this->bindingNavigatorMoveLastItem->Image = 
(cli::safe_cast(resources- 
>GetObject(L"bindingNavigatorMoveLastItem.Image"))); 
this->bindingNavigatorMoveLastItem->Name = 
L"bindingNavigatorMoveLastItem"; 
this->bindingNavigatorMoveLastItem->RightToLeftAutoMirrorImage = true; 
this->bindingNavigatorMoveLastItem->Size = System::Drawing::Size(23, 24); 


this->bindingNavigatorMoveLastItem->Text = L"Move last"; 
// 
// bindingNavigatorSeparator2 
// 
this->bindingNavigatorSeparator2->Name = 
L"bindingNavigatorSeparator2"; 
this->bindingNavigatorSeparator2->Size = System::Drawing::Size(6, 27); 
// 
// button1 
// 
this->button1->Location = System::Drawing::Point(94, 206); 
this->button1->Name = L"button1"; 
this->button1->Size = System::Drawing::Size(122, 62); 
this->button1->TabIndex = 2; 
this->button1->Text = L"Загрузить данные из БД в таблицу"; 
this->button1->UseVisualStyleBackColor = true; 
this->button1->Click += gcnew System::EventHandler(this, 
&Form1::button1_Click); 
// 
// dataGridView1 
// 
this->dataGridView1->AutoGenerateColumns = false; 
this->dataGridView1->ColumnHeadersHeightSizeMode = 
System::Windows::Forms::DataGridViewColumnHeadersHeightSizeMode::AutoSize; 
this->dataGridView1->Columns->AddRange(gcnew cli::array< 
System::Windows::Forms::DataGridViewColumn^ >(6) {this->Column1, 
this->column2DataGridViewTextBoxColumn, this- 
>column3DataGridViewTextBoxColumn, this->column4DataGridViewTextBoxColumn, 
this->column5DataGridViewTextBoxColumn, 
this->column6DataGridViewTextBoxColumn}); 
this->dataGridView1->DataSource = this->bindingSource1; 
this->dataGridView1->Location = System::Drawing::Point(12, 30); 
this->dataGridView1->Name = L"dataGridView1"; 
this->dataGridView1->RowTemplate->Height = 24; 
this->dataGridView1->Size = System::Drawing::Size(614, 170); 
this->dataGridView1->TabIndex = 3; 
// 
// button2 
// 
this->button2->Location = System::Drawing::Point(266, 206); 
this->button2->Name = L"button2"; 
this->button2->Size = System::Drawing::Size(108, 62); 
this->button2->TabIndex = 4; 
this->button2->Text = L"Вернуть данные в БД"; 
this->button2->UseVisualStyleBackColor = true; 


this->button2->Click += gcnew System::EventHandler(this, 
&Form1::button2_Click); 
// 
// button3 
// 
this->button3->Location = System::Drawing::Point(451, 206); 
this->button3->Name = L"button3"; 
this->button3->Size = System::Drawing::Size(75, 62); 
this->button3->TabIndex = 5; 
this->button3->Text = L"Выход"; 
this->button3->UseVisualStyleBackColor = true; 
this->button3->Click += gcnew System::EventHandler(this, 
&Form1::button3_Click); 
// 
// Column1 
// 
this->Column1->DataPropertyName = L"Column1"; 
this->Column1->HeaderText = L"Column1"; 
this->Column1->Name = L"Column1"; 
// 
// column2DataGridViewTextBoxColumn 
// 
this->column2DataGridViewTextBoxColumn->DataPropertyName = L"Column2"; 
this->column2DataGridViewTextBoxColumn->HeaderText = L"Column2"; 
this->column2DataGridViewTextBoxColumn->Name = 
L"column2DataGridViewTextBoxColumn"; 
// 
// column3DataGridViewTextBoxColumn 
// 
this->column3DataGridViewTextBoxColumn->DataPropertyName = L"Column3"; 
this->column3DataGridViewTextBoxColumn->HeaderText = L"Column3"; 
this->column3DataGridViewTextBoxColumn->Name = 
L"column3DataGridViewTextBoxColumn"; 
// 
// column4DataGridViewTextBoxColumn 
// 
this->column4DataGridViewTextBoxColumn->DataPropertyName = L"Column4"; 
this->column4DataGridViewTextBoxColumn->HeaderText = L"Column4"; 
this->column4DataGridViewTextBoxColumn->Name = 
L"column4DataGridViewTextBoxColumn"; 
// 
// column5DataGridViewTextBoxColumn 
// 
this->column5DataGridViewTextBoxColumn->DataPropertyName = L"Column5"; 
this->column5DataGridViewTextBoxColumn->HeaderText = L"Column5"; 
this->column5DataGridViewTextBoxColumn->Name = 


L"column5DataGridViewTextBoxColumn"; 
// 
// column6DataGridViewTextBoxColumn 
// 
this->column6DataGridViewTextBoxColumn->DataPropertyName = L"Column6"; 
this->column6DataGridViewTextBoxColumn->HeaderText = L"Column6"; 
this->column6DataGridViewTextBoxColumn->Name = 
L"column6DataGridViewTextBoxColumn"; 
// 
// Form1 
// 
this->AutoScaleDimensions = System::Drawing::SizeF(8, 16); 
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; 
this->ClientSize = System::Drawing::Size(654, 280); 
this->Controls->Add(this->button3); 
this->Controls->Add(this->button2); 
this->Controls->Add(this->dataGridView1); 
this->Controls->Add(this->button1); 
this->Controls->Add(this->bindingNavigator1); 
this->Name = L"Form1"; 
this->Text = L"Form1"; 
(cli::safe_cast>(this->bindingSource1))->EndInit(); 
(cli::safe_cast>(this->dataSet1))->EndInit(); 
(cli::safe_cast>(this->dataTable1))->EndInit(); 
(cli::safe_cast>(this->bindingNavigator1))->EndInit(); 
this->bindingNavigator1->ResumeLayout(false); 
this->bindingNavigator1->PerformLayout(); 
(cli::safe_cast>(this->dataGridView1))->EndInit(); 
this->ResumeLayout(false); 
this->PerformLayout(); 

#pragma endregion 
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) 

this->dataSet1->Clear(); //Очистка буфера перед чтением в него 
//таблицы 
this->oleDbDataAdapter1->Fill(dataTable1); 

private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) 

//Сохранить данные в БД 


this->oleDbDataAdapter1->Update(dataSet1->Tables["Авторы"]); 

private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) 

this->Close(); 

}; 


Download 1.6 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling