📄 book.cs
字号:
this.label7.TabIndex = 12;
this.label7.Text = "图书作者";
//
// textPublish
//
this.textPublish.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.objDataSetBook, "Book.BookPublish"));
this.textPublish.Location = new System.Drawing.Point(336, 40);
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, 106);
this.textName.Name = "textName";
this.textName.Size = new System.Drawing.Size(104, 23);
this.textName.TabIndex = 8;
this.textName.Text = "";
//
// textId
//
this.textId.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.objDataSetBook, "Book.BookID"));
this.textId.Location = new System.Drawing.Point(96, 72);
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(256, 112);
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(24, 112);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 23);
this.label2.TabIndex = 1;
this.label2.Text = "图书名称";
//
// label1
//
this.label1.Location = new System.Drawing.Point(24, 80);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(72, 23);
this.label1.TabIndex = 0;
this.label1.Text = "图书号码";
//
// label3
//
this.label3.Location = new System.Drawing.Point(256, 48);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(56, 16);
this.label3.TabIndex = 2;
this.label3.Text = "出版社";
//
// textPublishDate
//
this.textPublishDate.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.objDataSetBook, "Book.BookPublishDate"));
this.textPublishDate.Location = new System.Drawing.Point(336, 72);
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(256, 80);
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(336, 112);
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(328, 296);
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.btnCancel);
this.groupBox3.Controls.Add(this.btnApply);
this.groupBox3.Location = new System.Drawing.Point(24, 256);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(208, 80);
this.groupBox3.TabIndex = 29;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "编辑记录";
//
// btnCancel
//
this.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnCancel.Location = new System.Drawing.Point(120, 32);
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(24, 32);
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);
//
// conn
//
this.conn.ConnectionString = "workstation id=YXY1681;packet size=4096;integrated security=SSPI;data source=yxy1" +
"681;persist security info=False;initial catalog=BookManager";
//
// da
//
this.da.DeleteCommand = this.delComm;
this.da.InsertCommand = this.insertComm;
this.da.SelectCommand = this.selectComm;
this.da.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.da.UpdateCommand = this.updateComm;
//
// delComm
//
this.delComm.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.delComm.Connection = this.conn;
this.delComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookID", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookID", System.Data.DataRowVersion.Original, null));
this.delComm.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.delComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookName", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookName", System.Data.DataRowVersion.Original, null));
this.delComm.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.delComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookPublish", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookPublish", System.Data.DataRowVersion.Original, null));
this.delComm.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.delComm.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.delComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookSort", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookSort", System.Data.DataRowVersion.Original, null));
this.delComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookWriter", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookWriter", System.Data.DataRowVersion.Original, null));
//
// insertComm
//
this.insertComm.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.insertComm.Connection = this.conn;
this.insertComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookID", System.Data.SqlDbType.VarChar, 10, "BookID"));
this.insertComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookName", System.Data.SqlDbType.VarChar, 30, "BookName"));
this.insertComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookWriter", System.Data.SqlDbType.VarChar, 20, "BookWriter"));
this.insertComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookPublish", System.Data.SqlDbType.VarChar, 50, "BookPublish"));
this.insertComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookPublishDate", System.Data.SqlDbType.DateTime, 8, "BookPublishDate"));
this.insertComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookPrice", System.Data.SqlDbType.Float, 8, "BookPrice"));
this.insertComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookSort", System.Data.SqlDbType.VarChar, 20, "BookSort"));
this.insertComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookAmount", System.Data.SqlDbType.Int, 4, "BookAmount"));
this.insertComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookRemain", System.Data.SqlDbType.Int, 4, "BookRemain"));
//
// selectComm
//
this.selectComm.CommandText = "SELECT BookID, BookName, BookWriter, BookPublish, BookPublishDate, BookPrice, Boo" +
"kSort, BookAmount, BookRemain FROM Book";
this.selectComm.Connection = this.conn;
//
// updateComm
//
this.updateComm.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.updateComm.Connection = this.conn;
this.updateComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookID", System.Data.SqlDbType.VarChar, 10, "BookID"));
this.updateComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookName", System.Data.SqlDbType.VarChar, 30, "BookName"));
this.updateComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookWriter", System.Data.SqlDbType.VarChar, 20, "BookWriter"));
this.updateComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookPublish", System.Data.SqlDbType.VarChar, 50, "BookPublish"));
this.updateComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookPublishDate", System.Data.SqlDbType.DateTime, 8, "BookPublishDate"));
this.updateComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookPrice", System.Data.SqlDbType.Float, 8, "BookPrice"));
this.updateComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookSort", System.Data.SqlDbType.VarChar, 20, "BookSort"));
this.updateComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookAmount", System.Data.SqlDbType.Int, 4, "BookAmount"));
this.updateComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@BookRemain", System.Data.SqlDbType.Int, 4, "BookRemain"));
this.updateComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookID", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookID", System.Data.DataRowVersion.Original, null));
this.updateComm.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.updateComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookName", System.Data.SqlDbType.VarChar, 30, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookName", System.Data.DataRowVersion.Original, null));
this.updateComm.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.updateComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookPublish", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookPublish", System.Data.DataRowVersion.Original, null));
this.updateComm.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.updateComm.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.updateComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookSort", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "BookSort", System.Data.DataRowVersion.Original, null));
this.updateComm.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_BookWriter", System.Data.SqlDbType.VarChar, 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.LightBlue;
this.ClientSize = new System.Drawing.Size(498, 352);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.groupBox3);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Book";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -