⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bookborrow.h

📁 Visual C++.net数据库开发经典案例
💻 H
📖 第 1 页 / 共 2 页
字号:
#pragma once
#include "LinkDataBase.h"
#include "DataGridNoActiveCellColumn.h"

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;


namespace My
{
	/// <summary> 
	/// BookBorrow 摘要
	///
	/// 警告: 如果您更改该类的名称,则将需要更改 
	///          与该类所依赖的所有 .resx 文件关联的托管资源编译器工具的 
	///          “资源文件名”属性。  否则,
	///          设计器将不能与此窗体关联的
	///          本地化资源正确交互。
	/// </summary>
	public __gc class BookBorrow : public System::Windows::Forms::Form
	{
		//--------------------成员声明------------------------
	private:
		LinkDataBase* MyDataBase;	//数据库连接类
		SqlDataAdapter* BookAdapter;
		DataSet* ds;
		String* strTableName;
		int TotalBorrow;
		int ThisBorrow;
		String* ReaderID;
		String* strSQL;
		//-------------------成员声明结束-----------------------
	public: 
		BookBorrow(void)
		{
			InitializeComponent();
			//初始化
			this->MyDataBase = new LinkDataBase();
			this->ds = new DataSet();
			this->BookAdapter = new SqlDataAdapter();
			this->TotalBorrow = 0;
			this->ThisBorrow = 0;
			this->ReaderID = S"";

			//查询图书信息
			this->strSQL = S"Select 图书信息.*,图书类型.可借天数 from 图书信息,图书类型 Where 图书信息.类型 = 图书类型.类型名称";
			this->strTableName = S"图书信息";
			this->MyDataBase->SelectDataBase(this->BookAdapter,this->ds,this->strSQL,this->strTableName);			

			//查询读者信息
			this->strSQL = S"Select 读者信息.*,读者类型.图书册书 from 读者信息,读者类型 Where 读者信息.类型 = 读者类型.类型";
			this->strTableName = S"读者信息";
			this->MyDataBase->SelectDataBase(this->BookAdapter,this->ds,this->strSQL,this->strTableName);			
		}
        
	protected: 
		void Dispose(Boolean disposing)
		{
			if (disposing && components)
			{
				components->Dispose();
			}
			__super::Dispose(disposing);
		}
	private: System::Windows::Forms::ToolBar *  toolBar1;
	private: System::Windows::Forms::ToolBarButton *  tBtnPostModified;
	private: System::Windows::Forms::ToolBarButton *  tBtnCancleModified;
	private: System::Windows::Forms::ToolBarButton *  tBtnQuit;
	private: System::Windows::Forms::GroupBox *  groupBox1;
	private: System::Windows::Forms::Label *  label1;
	private: System::Windows::Forms::Label *  label2;
	private: System::Windows::Forms::Label *  label4;
	private: System::Windows::Forms::GroupBox *  groupBox2;
	private: System::Windows::Forms::DataGrid *  dgrdBooks;
	private: System::Windows::Forms::Label *  label26;
	private: System::ComponentModel::IContainer *  components;
    private: System::Windows::Forms::TextBox *  tBoxReaderName;
	private: System::Windows::Forms::TextBox *  tBoxSelectReader;
	private: System::Windows::Forms::TextBox *  tBoxBooksCanBorrow;
	private: System::Windows::Forms::GroupBox *  groupBox3;
	private: System::Windows::Forms::Label *  label17;

	private: System::Windows::Forms::TextBox *  tBoxReaderClass;
	private: System::Windows::Forms::Label *  label18;
	private: System::Windows::Forms::TextBox *  tBoxBookName;

	private: System::Windows::Forms::TextBox *  tBoxSelectBook;
	private: System::Windows::Forms::Label *  label19;
	private: System::Windows::Forms::ImageList *  imageList1;
	private: System::Windows::Forms::Label *  label3;
    private: System::Data::SqlClient::SqlDataAdapter *  BookBorrowAdapter;
	private: System::Data::SqlClient::SqlCommand *  sqlSelectCommand1;
	private: System::Data::SqlClient::SqlConnection *  sqlConnection1;
	private: System::Data::SqlClient::SqlCommand *  DeleteSqlCmd;
	private: System::Data::SqlClient::SqlCommand *  InsertSqlCmd;
    private: System::Windows::Forms::ComboBox *  cmbReader;
	private: System::Windows::Forms::ComboBox *  cmbBook;

	private:
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>


		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		void InitializeComponent(void)
		{
			this->components = new System::ComponentModel::Container();
			System::Resources::ResourceManager *  resources = new System::Resources::ResourceManager(__typeof(My::BookBorrow));
			this->toolBar1 = new System::Windows::Forms::ToolBar();
			this->tBtnPostModified = new System::Windows::Forms::ToolBarButton();
			this->tBtnCancleModified = new System::Windows::Forms::ToolBarButton();
			this->tBtnQuit = new System::Windows::Forms::ToolBarButton();
			this->imageList1 = new System::Windows::Forms::ImageList(this->components);
			this->groupBox1 = new System::Windows::Forms::GroupBox();
			this->cmbReader = new System::Windows::Forms::ComboBox();
			this->tBoxReaderName = new System::Windows::Forms::TextBox();
			this->label2 = new System::Windows::Forms::Label();
			this->tBoxSelectReader = new System::Windows::Forms::TextBox();
			this->label1 = new System::Windows::Forms::Label();
			this->tBoxBooksCanBorrow = new System::Windows::Forms::TextBox();
			this->label4 = new System::Windows::Forms::Label();
			this->tBoxReaderClass = new System::Windows::Forms::TextBox();
			this->label18 = new System::Windows::Forms::Label();
			this->dgrdBooks = new System::Windows::Forms::DataGrid();
			this->groupBox2 = new System::Windows::Forms::GroupBox();
			this->label26 = new System::Windows::Forms::Label();
			this->label3 = new System::Windows::Forms::Label();
			this->groupBox3 = new System::Windows::Forms::GroupBox();
			this->cmbBook = new System::Windows::Forms::ComboBox();
			this->tBoxSelectBook = new System::Windows::Forms::TextBox();
			this->label19 = new System::Windows::Forms::Label();
			this->tBoxBookName = new System::Windows::Forms::TextBox();
			this->label17 = new System::Windows::Forms::Label();
			this->BookBorrowAdapter = new System::Data::SqlClient::SqlDataAdapter();
			this->DeleteSqlCmd = new System::Data::SqlClient::SqlCommand();
			this->sqlConnection1 = new System::Data::SqlClient::SqlConnection();
			this->InsertSqlCmd = new System::Data::SqlClient::SqlCommand();
			this->sqlSelectCommand1 = new System::Data::SqlClient::SqlCommand();
			this->groupBox1->SuspendLayout();
			(__try_cast<System::ComponentModel::ISupportInitialize *  >(this->dgrdBooks))->BeginInit();
			this->groupBox2->SuspendLayout();
			this->groupBox3->SuspendLayout();
			this->SuspendLayout();
			// 
			// toolBar1
			// 
			System::Windows::Forms::ToolBarButton* __mcTemp__1[] = new System::Windows::Forms::ToolBarButton*[3];
			__mcTemp__1[0] = this->tBtnPostModified;
			__mcTemp__1[1] = this->tBtnCancleModified;
			__mcTemp__1[2] = this->tBtnQuit;
			this->toolBar1->Buttons->AddRange(__mcTemp__1);
			this->toolBar1->DropDownArrows = true;
			this->toolBar1->ImageList = this->imageList1;
			this->toolBar1->Location = System::Drawing::Point(0, 0);
			this->toolBar1->Name = S"toolBar1";
			this->toolBar1->ShowToolTips = true;
			this->toolBar1->Size = System::Drawing::Size(760, 41);
			this->toolBar1->TabIndex = 0;
			this->toolBar1->ButtonClick += new System::Windows::Forms::ToolBarButtonClickEventHandler(this, toolBar1_ButtonClick);
			// 
			// tBtnPostModified
			// 
			this->tBtnPostModified->ImageIndex = 0;
			this->tBtnPostModified->Text = S"借出";
			this->tBtnPostModified->ToolTipText = S"提交";
			// 
			// tBtnCancleModified
			// 
			this->tBtnCancleModified->ImageIndex = 2;
			this->tBtnCancleModified->Text = S"取消";
			this->tBtnCancleModified->ToolTipText = S"取消";
			// 
			// tBtnQuit
			// 
			this->tBtnQuit->Text = S"退出";
			this->tBtnQuit->ToolTipText = S"退出";
			// 
			// imageList1
			// 
			this->imageList1->ImageSize = System::Drawing::Size(16, 16);
			this->imageList1->ImageStream = (__try_cast<System::Windows::Forms::ImageListStreamer *  >(resources->GetObject(S"imageList1.ImageStream")));
			this->imageList1->TransparentColor = System::Drawing::Color::Transparent;
			// 
			// groupBox1
			// 
			this->groupBox1->Controls->Add(this->cmbReader);
			this->groupBox1->Controls->Add(this->tBoxReaderName);
			this->groupBox1->Controls->Add(this->label2);
			this->groupBox1->Controls->Add(this->tBoxSelectReader);
			this->groupBox1->Controls->Add(this->label1);
			this->groupBox1->Controls->Add(this->tBoxBooksCanBorrow);
			this->groupBox1->Controls->Add(this->label4);
			this->groupBox1->Controls->Add(this->tBoxReaderClass);
			this->groupBox1->Controls->Add(this->label18);
			this->groupBox1->Dock = System::Windows::Forms::DockStyle::Top;
			this->groupBox1->Location = System::Drawing::Point(0, 41);
			this->groupBox1->Name = S"groupBox1";
			this->groupBox1->Size = System::Drawing::Size(760, 79);
			this->groupBox1->TabIndex = 1;
			this->groupBox1->TabStop = false;
			// 
			// cmbReader
			// 
			System::Object* __mcTemp__2[] = new System::Object*[2];
			__mcTemp__2[0] = S"编号";
			__mcTemp__2[1] = S"条形码";
			this->cmbReader->Items->AddRange(__mcTemp__2);
			this->cmbReader->Location = System::Drawing::Point(152, 48);
			this->cmbReader->Name = S"cmbReader";
			this->cmbReader->Size = System::Drawing::Size(88, 20);
			this->cmbReader->TabIndex = 7;
			this->cmbReader->Text = S"请选择查询";
			// 
			// tBoxReaderName
			// 
			this->tBoxReaderName->Location = System::Drawing::Point(248, 48);
			this->tBoxReaderName->Name = S"tBoxReaderName";
			this->tBoxReaderName->ReadOnly = true;
			this->tBoxReaderName->Size = System::Drawing::Size(120, 21);
			this->tBoxReaderName->TabIndex = 4;
			this->tBoxReaderName->Text = S"";
			// 
			// label2
			// 
			this->label2->Location = System::Drawing::Point(248, 24);
			this->label2->Name = S"label2";
			this->label2->Size = System::Drawing::Size(56, 11);
			this->label2->TabIndex = 3;
			this->label2->Text = S"读者姓名";
			// 
			// tBoxSelectReader
			// 
			this->tBoxSelectReader->Location = System::Drawing::Point(24, 48);
			this->tBoxSelectReader->Name = S"tBoxSelectReader";
			this->tBoxSelectReader->Size = System::Drawing::Size(120, 21);
			this->tBoxSelectReader->TabIndex = 2;
			this->tBoxSelectReader->Text = S"";
			this->tBoxSelectReader->KeyUp += new System::Windows::Forms::KeyEventHandler(this, tBoxSelectReader_KeyUp);
			// 
			// label1
			// 
			this->label1->Location = System::Drawing::Point(24, 24);
			this->label1->Name = S"label1";
			this->label1->Size = System::Drawing::Size(120, 11);
			this->label1->TabIndex = 1;
			this->label1->Text = S"输入后回车选择读者";
			// 
			// tBoxBooksCanBorrow
			// 
			this->tBoxBooksCanBorrow->Location = System::Drawing::Point(504, 48);
			this->tBoxBooksCanBorrow->Name = S"tBoxBooksCanBorrow";
			this->tBoxBooksCanBorrow->ReadOnly = true;
			this->tBoxBooksCanBorrow->Size = System::Drawing::Size(120, 21);
			this->tBoxBooksCanBorrow->TabIndex = 6;
			this->tBoxBooksCanBorrow->Text = S"";
			// 
			// label4
			// 
			this->label4->Location = System::Drawing::Point(504, 24);
			this->label4->Name = S"label4";
			this->label4->Size = System::Drawing::Size(56, 11);
			this->label4->TabIndex = 5;
			this->label4->Text = S"可借册数";
			// 
			// tBoxReaderClass
			// 
			this->tBoxReaderClass->Location = System::Drawing::Point(376, 48);
			this->tBoxReaderClass->Name = S"tBoxReaderClass";
			this->tBoxReaderClass->ReadOnly = true;
			this->tBoxReaderClass->Size = System::Drawing::Size(120, 21);
			this->tBoxReaderClass->TabIndex = 6;
			this->tBoxReaderClass->Text = S"";
			// 
			// label18
			// 
			this->label18->Location = System::Drawing::Point(368, 24);
			this->label18->Name = S"label18";
			this->label18->Size = System::Drawing::Size(56, 11);
			this->label18->TabIndex = 5;
			this->label18->Text = S"读者类型";
			// 
			// dgrdBooks
			// 
			this->dgrdBooks->DataMember = S"";
			this->dgrdBooks->Dock = System::Windows::Forms::DockStyle::Fill;
			this->dgrdBooks->HeaderForeColor = System::Drawing::SystemColors::ControlText;
			this->dgrdBooks->Location = System::Drawing::Point(0, 208);
			this->dgrdBooks->Name = S"dgrdBooks";
			this->dgrdBooks->Size = System::Drawing::Size(760, 181);
			this->dgrdBooks->TabIndex = 2;
			// 
			// groupBox2
			// 
			this->groupBox2->Controls->Add(this->label26);
			this->groupBox2->Controls->Add(this->label3);
			this->groupBox2->Dock = System::Windows::Forms::DockStyle::Bottom;
			this->groupBox2->Location = System::Drawing::Point(0, 389);
			this->groupBox2->Name = S"groupBox2";
			this->groupBox2->Size = System::Drawing::Size(760, 40);
			this->groupBox2->TabIndex = 3;
			this->groupBox2->TabStop = false;
			// 
			// label26
			// 
			this->label26->Location = System::Drawing::Point(72, 16);
			this->label26->Name = S"label26";
			this->label26->Size = System::Drawing::Size(128, 11);
			this->label26->TabIndex = 48;
			this->label26->Text = S"已借书";
			// 
			// label3

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -