📄 book.cs
字号:
//
// textWriter
//
this.textWriter.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.objDataSetBook, "Book.BookWriter"));
this.textWriter.Location = new System.Drawing.Point(96, 96);
this.textWriter.Name = "textWriter";
this.textWriter.Size = new System.Drawing.Size(104, 23);
this.textWriter.TabIndex = 13;
this.textWriter.Text = "";
//
// label7
//
this.label7.Location = new System.Drawing.Point(16, 96);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(72, 23);
this.label7.TabIndex = 12;
this.label7.Text = "图书作者";
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// textPublish
//
this.textPublish.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.objDataSetBook, "Book.BookPublish"));
this.textPublish.Location = new System.Drawing.Point(96, 168);
this.textPublish.Name = "textPublish";
this.textPublish.Size = new System.Drawing.Size(104, 23);
this.textPublish.TabIndex = 10;
this.textPublish.Text = "";
//
// textName
//
this.textName.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.objDataSetBook, "Book.BookName"));
this.textName.Location = new System.Drawing.Point(96, 56);
this.textName.Name = "textName";
this.textName.Size = new System.Drawing.Size(104, 23);
this.textName.TabIndex = 8;
this.textName.Text = "";
//
// objDataSetBook
//
this.objDataSetBook.DataSetName = "DataSetBook";
this.objDataSetBook.Locale = new System.Globalization.CultureInfo("zh-CN");
//
// textId
//
this.textId.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.objDataSetBook, "Book.BookID"));
this.textId.Location = new System.Drawing.Point(96, 24);
this.textId.Name = "textId";
this.textId.Size = new System.Drawing.Size(104, 23);
this.textId.TabIndex = 7;
this.textId.Text = "";
//
// label4
//
this.label4.Location = new System.Drawing.Point(240, 64);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(64, 23);
this.label4.TabIndex = 3;
this.label4.Text = "图书分类";
//
// label2
//
this.label2.Location = new System.Drawing.Point(16, 56);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 23);
this.label2.TabIndex = 1;
this.label2.Text = "图书名称";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label1
//
this.label1.Location = new System.Drawing.Point(16, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(72, 23);
this.label1.TabIndex = 0;
this.label1.Text = "图书编号";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label3
//
this.label3.Location = new System.Drawing.Point(16, 168);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(72, 23);
this.label3.TabIndex = 2;
this.label3.Text = "出版社";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// textPublishDate
//
this.textPublishDate.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.objDataSetBook, "Book.BookPublishDate"));
this.textPublishDate.Location = new System.Drawing.Point(320, 24);
this.textPublishDate.Name = "textPublishDate";
this.textPublishDate.Size = new System.Drawing.Size(104, 23);
this.textPublishDate.TabIndex = 9;
this.textPublishDate.Text = "";
//
// label5
//
this.label5.Location = new System.Drawing.Point(240, 32);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(64, 23);
this.label5.TabIndex = 4;
this.label5.Text = "出版时间";
//
// textSort
//
this.textSort.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.objDataSetBook, "Book.BookSort"));
this.textSort.Location = new System.Drawing.Point(320, 64);
this.textSort.Name = "textSort";
this.textSort.Size = new System.Drawing.Size(104, 23);
this.textSort.TabIndex = 11;
this.textSort.Text = "";
//
// btnExit
//
this.btnExit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnExit.Location = new System.Drawing.Point(232, 336);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(72, 32);
this.btnExit.TabIndex = 27;
this.btnExit.Text = "退出";
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.btnAdd);
this.groupBox3.Controls.Add(this.btnModify);
this.groupBox3.Controls.Add(this.btnCancel);
this.groupBox3.Controls.Add(this.btnApply);
this.groupBox3.Controls.Add(this.btnDelete);
this.groupBox3.Location = new System.Drawing.Point(72, 256);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(400, 72);
this.groupBox3.TabIndex = 29;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "编辑记录";
//
// btnAdd
//
this.btnAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAdd.Location = new System.Drawing.Point(24, 24);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(56, 24);
this.btnAdd.TabIndex = 13;
this.btnAdd.Text = "添加";
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// btnModify
//
this.btnModify.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnModify.Location = new System.Drawing.Point(88, 24);
this.btnModify.Name = "btnModify";
this.btnModify.Size = new System.Drawing.Size(56, 24);
this.btnModify.TabIndex = 15;
this.btnModify.Text = "修改";
this.btnModify.Click += new System.EventHandler(this.btnModify_Click);
//
// btnCancel
//
this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCancel.Location = new System.Drawing.Point(280, 24);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(56, 24);
this.btnCancel.TabIndex = 11;
this.btnCancel.Text = "取消";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnApply
//
this.btnApply.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnApply.Location = new System.Drawing.Point(216, 24);
this.btnApply.Name = "btnApply";
this.btnApply.Size = new System.Drawing.Size(56, 24);
this.btnApply.TabIndex = 12;
this.btnApply.Text = "确定";
this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "workstation id=WJD;packet size=4096;integrated security=SSPI;data source=WJD;pers" +
"ist security info=False;initial catalog=BookManagement";
//
// sqlDataAdapter1
//
this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1;
this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "Book", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("BookID", "BookID"),
new System.Data.Common.DataColumnMapping("BookName", "BookName"),
new System.Data.Common.DataColumnMapping("BookWriter", "BookWriter"),
new System.Data.Common.DataColumnMapping("BookPublish", "BookPublish"),
new System.Data.Common.DataColumnMapping("BookPublishDate", "BookPublishDate"),
new System.Data.Common.DataColumnMapping("BookPrice", "BookPrice"),
new System.Data.Common.DataColumnMapping("BookSort", "BookSort"),
new System.Data.Common.DataColumnMapping("BookAmount", "BookAmount"),
new System.Data.Common.DataColumnMapping("BookRemain", "BookRemain")})});
this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1;
//
// sqlDeleteCommand1
//
this.sqlDeleteCommand1.CommandText = @"DELETE FROM Book WHERE (BookID = @Original_BookID) AND (BookAmount = @Original_BookAmount OR @Original_BookAmount IS NULL AND BookAmount IS NULL) AND (BookName = @Original_BookName OR @Original_BookName IS NULL AND BookName IS NULL) AND (BookPrice = @Original_BookPrice OR @Original_BookPrice IS NULL AND BookPrice IS NULL) AND (BookPublish = @Original_BookPublish OR @Original_BookPublish IS NULL AND BookPublish IS NULL) AND (BookPublishDate = @Original_BookPublishDate OR @Original_BookPublishDate IS NULL AND BookPublishDate IS NULL) AND (BookRemain = @Original_BookRemain OR @Original_BookRemain IS NULL AND BookRemain IS NULL) AND (BookSort = @Original_BookSort OR @Original_BookSort IS NULL AND BookSort IS NULL) AND (BookWriter = @Original_BookWriter OR @Original_BookWriter IS NULL AND BookWriter IS NULL)";
this.sqlDeleteCommand1.Connection = this.sqlConnection1;
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookID", System.Data.SqlDbType.NVarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookID", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookAmount", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookAmount", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookName", System.Data.SqlDbType.NVarChar, 30, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookName", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookPrice", System.Data.SqlDbType.Float, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookPrice", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookPublish", System.Data.SqlDbType.NVarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookPublish", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookPublishDate", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookPublishDate", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookRemain", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookRemain", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookSort", System.Data.SqlDbType.NVarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookSort", System.Data.DataRowVersion.Original, null));
this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookWriter", System.Data.SqlDbType.NVarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookWriter", System.Data.DataRowVersion.Original, null));
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = @"INSERT INTO Book(BookID, BookName, BookWriter, BookPublish, BookPublishDate, BookPrice, BookSort, BookAmount, BookRemain) VALUES (@BookID, @BookName, @BookWriter, @BookPublish, @BookPublishDate, @BookPrice, @BookSort, @BookAmount, @BookRemain); SELECT BookID, BookName, BookWriter, BookPublish, BookPublishDate, BookPrice, BookSort, BookAmount, BookRemain FROM Book WHERE (BookID = @BookID)";
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookID", System.Data.SqlDbType.NVarChar, 10, "BookID"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookName", System.Data.SqlDbType.NVarChar, 30, "BookName"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookWriter", System.Data.SqlDbType.NVarChar, 20, "BookWriter"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookPublish", System.Data.SqlDbType.NVarChar, 50, "BookPublish"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookPublishDate", System.Data.SqlDbType.DateTime, 8, "BookPublishDate"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookPrice", System.Data.SqlDbType.Float, 8, "BookPrice"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookSort", System.Data.SqlDbType.NVarChar, 20, "BookSort"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookAmount", System.Data.SqlDbType.Int, 4, "BookAmount"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookRemain", System.Data.SqlDbType.Int, 4, "BookRemain"));
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT BookID, BookName, BookWriter, BookPublish, BookPublishDate, BookPrice, Boo" +
"kSort, BookAmount, BookRemain FROM Book";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
//
// sqlUpdateCommand1
//
this.sqlUpdateCommand1.CommandText = @"UPDATE Book SET BookID = @BookID, BookName = @BookName, BookWriter = @BookWriter, BookPublish = @BookPublish, BookPublishDate = @BookPublishDate, BookPrice = @BookPrice, BookSort = @BookSort, BookAmount = @BookAmount, BookRemain = @BookRemain WHERE (BookID = @Original_BookID) AND (BookAmount = @Original_BookAmount OR @Original_BookAmount IS NULL AND BookAmount IS NULL) AND (BookName = @Original_BookName OR @Original_BookName IS NULL AND BookName IS NULL) AND (BookPrice = @Original_BookPrice OR @Original_BookPrice IS NULL AND BookPrice IS NULL) AND (BookPublish = @Original_BookPublish OR @Original_BookPublish IS NULL AND BookPublish IS NULL) AND (BookPublishDate = @Original_BookPublishDate OR @Original_BookPublishDate IS NULL AND BookPublishDate IS NULL) AND (BookRemain = @Original_BookRemain OR @Original_BookRemain IS NULL AND BookRemain IS NULL) AND (BookSort = @Original_BookSort OR @Original_BookSort IS NULL AND BookSort IS NULL) AND (BookWriter = @Original_BookWriter OR @Original_BookWriter IS NULL AND BookWriter IS NULL); SELECT BookID, BookName, BookWriter, BookPublish, BookPublishDate, BookPrice, BookSort, BookAmount, BookRemain FROM Book WHERE (BookID = @BookID)";
this.sqlUpdateCommand1.Connection = this.sqlConnection1;
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookID", System.Data.SqlDbType.NVarChar, 10, "BookID"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookName", System.Data.SqlDbType.NVarChar, 30, "BookName"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookWriter", System.Data.SqlDbType.NVarChar, 20, "BookWriter"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookPublish", System.Data.SqlDbType.NVarChar, 50, "BookPublish"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookPublishDate", System.Data.SqlDbType.DateTime, 8, "BookPublishDate"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookPrice", System.Data.SqlDbType.Float, 8, "BookPrice"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookSort", System.Data.SqlDbType.NVarChar, 20, "BookSort"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookAmount", System.Data.SqlDbType.Int, 4, "BookAmount"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookRemain", System.Data.SqlDbType.Int, 4, "BookRemain"));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookID", System.Data.SqlDbType.NVarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookID", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookAmount", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookAmount", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookName", System.Data.SqlDbType.NVarChar, 30, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookName", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookPrice", System.Data.SqlDbType.Float, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookPrice", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookPublish", System.Data.SqlDbType.NVarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookPublish", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookPublishDate", System.Data.SqlDbType.DateTime, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookPublishDate", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookRemain", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookRemain", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookSort", System.Data.SqlDbType.NVarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookSort", System.Data.DataRowVersion.Original, null));
this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookWriter", System.Data.SqlDbType.NVarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookWriter", System.Data.DataRowVersion.Original, null));
//
// Book
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackColor = System.Drawing.Color.LightGray;
this.ClientSize = new System.Drawing.Size(512, 373);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.groupBox3);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Book";
this.Text = "图书信息维护";
this.Load += new System.EventHandler(this.Book_Load);
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.objDataSetBook)).EndInit();
this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
public void ErrorHandle(System.Exception E)
{
MessageBox.Show(E.ToString());
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -