BookInfo.cs
资源名称:VCSDB.rar [点击查看]
上传用户:hjieqiu
上传日期:2013-05-11
资源大小:16494k
文件大小:51k
源码类别:
企业管理
开发平台:
C#
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- using System.Data.SqlClient;
- using System.Data;
- namespace 图书馆管理系统
- {
- /// <summary>
- /// BookInfo 的摘要说明。
- /// </summary>
- public class BookInfo : System.Windows.Forms.Form
- {
- private CurrencyManager cmOrders;
- private System.Windows.Forms.DataGrid dataGrid1;
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.Button btnSearch;
- private System.Windows.Forms.TextBox txt1;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.TextBox txt2;
- private System.Windows.Forms.Label label3;
- private System.Windows.Forms.TextBox txt3;
- private System.Windows.Forms.GroupBox groupBox2;
- private System.Windows.Forms.ComboBox cmb1;
- private System.Windows.Forms.Label label4;
- private System.Windows.Forms.TextBox txt4;
- private System.Windows.Forms.TextBox txt5;
- private System.Windows.Forms.TextBox txt6;
- private System.Windows.Forms.Label label5;
- private System.Windows.Forms.Label label6;
- private System.Windows.Forms.Label label7;
- private System.Windows.Forms.TextBox txt7;
- private System.Windows.Forms.TextBox txt8;
- private System.Windows.Forms.TextBox txt9;
- private System.Windows.Forms.Label label8;
- private System.Windows.Forms.ComboBox cmb2;
- private System.Windows.Forms.Label label9;
- private System.Windows.Forms.Label label11;
- private System.Windows.Forms.Label label12;
- private System.Windows.Forms.TextBox txt10;
- private System.Windows.Forms.TextBox txt11;
- private System.Windows.Forms.ComboBox cmb3;
- private System.Windows.Forms.Label label10;
- private System.Windows.Forms.Label label17;
- private System.Windows.Forms.Label label16;
- private System.Windows.Forms.Label label13;
- private System.Windows.Forms.TextBox txt12;
- private System.Windows.Forms.CheckBox checkBox1;
- private System.Windows.Forms.Label label18;
- private System.Windows.Forms.ToolBar toolBar1;
- private System.Windows.Forms.ToolBarButton tBtnFirst;
- private System.Windows.Forms.ToolBarButton tBtnPre;
- private System.Windows.Forms.ToolBarButton tBtnNext;
- private System.Windows.Forms.ToolBarButton tBtnLast;
- private System.Windows.Forms.ToolBarButton tBtnNew;
- private System.Windows.Forms.ToolBarButton tBtnEdit;
- private System.Windows.Forms.ToolBarButton tBtnDelete;
- private System.Windows.Forms.ToolBarButton tBtnSubmit;
- private System.Windows.Forms.ToolBarButton tBtnCancel;
- private System.Windows.Forms.ToolBarButton tBtnQuit;
- private System.Windows.Forms.ImageList imageList1;
- private System.Data.SqlClient.SqlDataAdapter da1;
- private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
- private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
- private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
- private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
- private System.Data.SqlClient.SqlConnection sqlConnection1;
- private System.Windows.Forms.TextBox txt13;
- private 图书馆管理系统.DataSet1 dataSet11;
- private System.ComponentModel.IContainer components;
- public BookInfo()
- {
- //
- // Windows 窗体设计器支持所必需的
- //
- InitializeComponent();
- //
- // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
- //
- }
- /// <summary>
- /// 清理所有正在使用的资源。
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if(components != null)
- {
- components.Dispose();
- }
- }
- base.Dispose( disposing );
- }
- #region Windows 窗体设计器生成的代码
- /// <summary>
- /// 设计器支持所需的方法 - 不要使用代码编辑器修改
- /// 此方法的内容。
- /// </summary>
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(BookInfo));
- this.dataGrid1 = new System.Windows.Forms.DataGrid();
- this.dataSet11 = new 图书馆管理系统.DataSet1();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.btnSearch = new System.Windows.Forms.Button();
- this.txt1 = new System.Windows.Forms.TextBox();
- this.label2 = new System.Windows.Forms.Label();
- this.label1 = new System.Windows.Forms.Label();
- this.txt2 = new System.Windows.Forms.TextBox();
- this.label3 = new System.Windows.Forms.Label();
- this.txt3 = new System.Windows.Forms.TextBox();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.checkBox1 = new System.Windows.Forms.CheckBox();
- this.txt13 = new System.Windows.Forms.TextBox();
- this.label18 = new System.Windows.Forms.Label();
- this.txt10 = new System.Windows.Forms.TextBox();
- this.txt11 = new System.Windows.Forms.TextBox();
- this.cmb3 = new System.Windows.Forms.ComboBox();
- this.label10 = new System.Windows.Forms.Label();
- this.label17 = new System.Windows.Forms.Label();
- this.label16 = new System.Windows.Forms.Label();
- this.txt7 = new System.Windows.Forms.TextBox();
- this.txt8 = new System.Windows.Forms.TextBox();
- this.txt9 = new System.Windows.Forms.TextBox();
- this.label8 = new System.Windows.Forms.Label();
- this.cmb2 = new System.Windows.Forms.ComboBox();
- this.label9 = new System.Windows.Forms.Label();
- this.label11 = new System.Windows.Forms.Label();
- this.label12 = new System.Windows.Forms.Label();
- this.cmb1 = new System.Windows.Forms.ComboBox();
- this.label4 = new System.Windows.Forms.Label();
- this.txt4 = new System.Windows.Forms.TextBox();
- this.txt5 = new System.Windows.Forms.TextBox();
- this.txt6 = new System.Windows.Forms.TextBox();
- this.label5 = new System.Windows.Forms.Label();
- this.label6 = new System.Windows.Forms.Label();
- this.label7 = new System.Windows.Forms.Label();
- this.label13 = new System.Windows.Forms.Label();
- this.txt12 = new System.Windows.Forms.TextBox();
- this.toolBar1 = new System.Windows.Forms.ToolBar();
- this.tBtnFirst = new System.Windows.Forms.ToolBarButton();
- this.tBtnPre = new System.Windows.Forms.ToolBarButton();
- this.tBtnNext = new System.Windows.Forms.ToolBarButton();
- this.tBtnLast = new System.Windows.Forms.ToolBarButton();
- this.tBtnNew = new System.Windows.Forms.ToolBarButton();
- this.tBtnEdit = new System.Windows.Forms.ToolBarButton();
- this.tBtnDelete = new System.Windows.Forms.ToolBarButton();
- this.tBtnSubmit = new System.Windows.Forms.ToolBarButton();
- this.tBtnCancel = new System.Windows.Forms.ToolBarButton();
- this.tBtnQuit = new System.Windows.Forms.ToolBarButton();
- this.imageList1 = new System.Windows.Forms.ImageList(this.components);
- this.da1 = new System.Data.SqlClient.SqlDataAdapter();
- this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
- this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
- this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
- this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
- this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
- ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
- this.groupBox1.SuspendLayout();
- this.groupBox2.SuspendLayout();
- this.SuspendLayout();
- //
- // dataGrid1
- //
- this.dataGrid1.CaptionVisible = false;
- this.dataGrid1.DataMember = "图书信息";
- this.dataGrid1.DataSource = this.dataSet11;
- this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
- this.dataGrid1.Location = new System.Drawing.Point(0, 96);
- this.dataGrid1.Name = "dataGrid1";
- this.dataGrid1.ReadOnly = true;
- this.dataGrid1.Size = new System.Drawing.Size(696, 200);
- this.dataGrid1.TabIndex = 37;
- //
- // dataSet11
- //
- this.dataSet11.DataSetName = "DataSet1";
- this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.btnSearch);
- this.groupBox1.Controls.Add(this.txt1);
- this.groupBox1.Controls.Add(this.label2);
- this.groupBox1.Controls.Add(this.label1);
- this.groupBox1.Controls.Add(this.txt2);
- this.groupBox1.Controls.Add(this.label3);
- this.groupBox1.Controls.Add(this.txt3);
- this.groupBox1.Location = new System.Drawing.Point(0, 40);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(696, 56);
- this.groupBox1.TabIndex = 35;
- this.groupBox1.TabStop = false;
- //
- // btnSearch
- //
- this.btnSearch.Image = ((System.Drawing.Image)(resources.GetObject("btnSearch.Image")));
- this.btnSearch.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.btnSearch.Location = new System.Drawing.Point(16, 24);
- this.btnSearch.Name = "btnSearch";
- this.btnSearch.Size = new System.Drawing.Size(72, 23);
- this.btnSearch.TabIndex = 0;
- this.btnSearch.Text = " 搜索";
- this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
- //
- // txt1
- //
- this.txt1.Location = new System.Drawing.Point(168, 24);
- this.txt1.Name = "txt1";
- this.txt1.TabIndex = 2;
- this.txt1.Text = "";
- //
- // label2
- //
- this.label2.Location = new System.Drawing.Point(104, 28);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(56, 16);
- this.label2.TabIndex = 1;
- this.label2.Text = "条形码";
- //
- // label1
- //
- this.label1.Location = new System.Drawing.Point(328, 28);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(32, 16);
- this.label1.TabIndex = 1;
- this.label1.Text = "编号";
- //
- // txt2
- //
- this.txt2.Location = new System.Drawing.Point(360, 24);
- this.txt2.Name = "txt2";
- this.txt2.TabIndex = 2;
- this.txt2.Text = "";
- //
- // label3
- //
- this.label3.Location = new System.Drawing.Point(520, 28);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(32, 16);
- this.label3.TabIndex = 1;
- this.label3.Text = "书名";
- //
- // txt3
- //
- this.txt3.Location = new System.Drawing.Point(552, 24);
- this.txt3.Name = "txt3";
- this.txt3.TabIndex = 2;
- this.txt3.Text = "";
- //
- // groupBox2
- //
- this.groupBox2.Controls.Add(this.checkBox1);
- this.groupBox2.Controls.Add(this.txt13);
- this.groupBox2.Controls.Add(this.label18);
- this.groupBox2.Controls.Add(this.txt10);
- this.groupBox2.Controls.Add(this.txt11);
- this.groupBox2.Controls.Add(this.cmb3);
- this.groupBox2.Controls.Add(this.label10);
- this.groupBox2.Controls.Add(this.label17);
- this.groupBox2.Controls.Add(this.label16);
- this.groupBox2.Controls.Add(this.txt7);
- this.groupBox2.Controls.Add(this.txt8);
- this.groupBox2.Controls.Add(this.txt9);
- this.groupBox2.Controls.Add(this.label8);
- this.groupBox2.Controls.Add(this.cmb2);
- this.groupBox2.Controls.Add(this.label9);
- this.groupBox2.Controls.Add(this.label11);
- this.groupBox2.Controls.Add(this.label12);
- this.groupBox2.Controls.Add(this.cmb1);
- this.groupBox2.Controls.Add(this.label4);
- this.groupBox2.Controls.Add(this.txt4);
- this.groupBox2.Controls.Add(this.txt5);
- this.groupBox2.Controls.Add(this.txt6);
- this.groupBox2.Controls.Add(this.label5);
- this.groupBox2.Controls.Add(this.label6);
- this.groupBox2.Controls.Add(this.label7);
- this.groupBox2.Controls.Add(this.label13);
- this.groupBox2.Controls.Add(this.txt12);
- this.groupBox2.Location = new System.Drawing.Point(0, 295);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(696, 216);
- this.groupBox2.TabIndex = 38;
- this.groupBox2.TabStop = false;
- //
- // checkBox1
- //
- this.checkBox1.Checked = true;
- this.checkBox1.CheckState = System.Windows.Forms.CheckState.Indeterminate;
- this.checkBox1.DataBindings.Add(new System.Windows.Forms.Binding("Checked", this.dataSet11, "图书信息.是否注销"));
- this.checkBox1.Enabled = false;
- this.checkBox1.Location = new System.Drawing.Point(560, 136);
- this.checkBox1.Name = "checkBox1";
- this.checkBox1.Size = new System.Drawing.Size(80, 24);
- this.checkBox1.TabIndex = 60;
- this.checkBox1.Text = "是否注销";
- this.checkBox1.ThreeState = true;
- //
- // txt13
- //
- this.txt13.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "图书信息.简介"));
- this.txt13.Location = new System.Drawing.Point(32, 184);
- this.txt13.Name = "txt13";
- this.txt13.ReadOnly = true;
- this.txt13.Size = new System.Drawing.Size(608, 21);
- this.txt13.TabIndex = 59;
- this.txt13.Text = "";
- //
- // label18
- //
- this.label18.Location = new System.Drawing.Point(32, 168);
- this.label18.Name = "label18";
- this.label18.Size = new System.Drawing.Size(48, 16);
- this.label18.TabIndex = 58;
- this.label18.Text = "简介";
- //
- // txt10
- //
- this.txt10.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "图书信息.价格"));
- this.txt10.Location = new System.Drawing.Point(32, 136);
- this.txt10.Name = "txt10";
- this.txt10.ReadOnly = true;
- this.txt10.Size = new System.Drawing.Size(112, 21);
- this.txt10.TabIndex = 55;
- this.txt10.Text = "";
- //
- // txt11
- //
- this.txt11.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "图书信息.页码"));
- this.txt11.Location = new System.Drawing.Point(168, 136);
- this.txt11.Name = "txt11";
- this.txt11.ReadOnly = true;
- this.txt11.Size = new System.Drawing.Size(96, 21);
- this.txt11.TabIndex = 56;
- this.txt11.Text = "";
- //
- // cmb3
- //
- this.cmb3.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "图书信息.书架名称"));
- this.cmb3.Enabled = false;
- this.cmb3.Items.AddRange(new object[] {
- "身份证",
- "学生证",
- "教师证",
- "公务员证",
- "其他证件"});
- this.cmb3.Location = new System.Drawing.Point(408, 136);
- this.cmb3.Name = "cmb3";
- this.cmb3.Size = new System.Drawing.Size(128, 20);
- this.cmb3.TabIndex = 57;
- //
- // label10
- //
- this.label10.Location = new System.Drawing.Point(416, 120);
- this.label10.Name = "label10";
- this.label10.Size = new System.Drawing.Size(56, 16);
- this.label10.TabIndex = 52;
- this.label10.Text = "书架名称";
- //
- // label17
- //
- this.label17.Location = new System.Drawing.Point(32, 120);
- this.label17.Name = "label17";
- this.label17.Size = new System.Drawing.Size(88, 16);
- this.label17.TabIndex = 53;
- this.label17.Text = "价格";
- //
- // label16
- //
- this.label16.Location = new System.Drawing.Point(168, 120);
- this.label16.Name = "label16";
- this.label16.Size = new System.Drawing.Size(88, 16);
- this.label16.TabIndex = 54;
- this.label16.Text = "页码";
- //
- // txt7
- //
- this.txt7.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "图书信息.作者"));
- this.txt7.Location = new System.Drawing.Point(32, 88);
- this.txt7.Name = "txt7";
- this.txt7.ReadOnly = true;
- this.txt7.TabIndex = 49;
- this.txt7.Text = "";
- //
- // txt8
- //
- this.txt8.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "图书信息.译者"));
- this.txt8.Location = new System.Drawing.Point(160, 88);
- this.txt8.Name = "txt8";
- this.txt8.ReadOnly = true;
- this.txt8.TabIndex = 48;
- this.txt8.Text = "";
- //
- // txt9
- //
- this.txt9.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "图书信息.ISBN"));
- this.txt9.Location = new System.Drawing.Point(288, 88);
- this.txt9.Name = "txt9";
- this.txt9.ReadOnly = true;
- this.txt9.Size = new System.Drawing.Size(168, 21);
- this.txt9.TabIndex = 50;
- this.txt9.Text = "";
- //
- // label8
- //
- this.label8.Location = new System.Drawing.Point(480, 72);
- this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(56, 16);
- this.label8.TabIndex = 47;
- this.label8.Text = "出版社";
- //
- // cmb2
- //
- this.cmb2.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "图书信息.出版社"));
- this.cmb2.Enabled = false;
- this.cmb2.Location = new System.Drawing.Point(480, 88);
- this.cmb2.Name = "cmb2";
- this.cmb2.Size = new System.Drawing.Size(160, 20);
- this.cmb2.TabIndex = 51;
- //
- // label9
- //
- this.label9.Location = new System.Drawing.Point(32, 72);
- this.label9.Name = "label9";
- this.label9.Size = new System.Drawing.Size(56, 16);
- this.label9.TabIndex = 44;
- this.label9.Text = "作者";
- //
- // label11
- //
- this.label11.Location = new System.Drawing.Point(288, 72);
- this.label11.Name = "label11";
- this.label11.Size = new System.Drawing.Size(88, 16);
- this.label11.TabIndex = 45;
- this.label11.Text = "ISBN";
- //
- // label12
- //
- this.label12.Location = new System.Drawing.Point(160, 72);
- this.label12.Name = "label12";
- this.label12.Size = new System.Drawing.Size(56, 16);
- this.label12.TabIndex = 46;
- this.label12.Text = "译者";
- //
- // cmb1
- //
- this.cmb1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "图书信息.类型"));
- this.cmb1.Enabled = false;
- this.cmb1.Location = new System.Drawing.Point(504, 40);
- this.cmb1.Name = "cmb1";
- this.cmb1.Size = new System.Drawing.Size(136, 20);
- this.cmb1.TabIndex = 43;
- //
- // label4
- //
- this.label4.Location = new System.Drawing.Point(32, 24);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(56, 16);
- this.label4.TabIndex = 39;
- this.label4.Text = "条形码";
- //
- // txt4
- //
- this.txt4.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "图书信息.条形码"));
- this.txt4.Location = new System.Drawing.Point(32, 40);
- this.txt4.Name = "txt4";
- this.txt4.ReadOnly = true;
- this.txt4.TabIndex = 41;
- this.txt4.Text = "";
- //
- // txt5
- //
- this.txt5.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "图书信息.编号"));
- this.txt5.Location = new System.Drawing.Point(160, 40);
- this.txt5.Name = "txt5";
- this.txt5.ReadOnly = true;
- this.txt5.TabIndex = 42;
- this.txt5.Text = "";
- //
- // txt6
- //
- this.txt6.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "图书信息.书名"));
- this.txt6.Location = new System.Drawing.Point(288, 40);
- this.txt6.Name = "txt6";
- this.txt6.ReadOnly = true;
- this.txt6.Size = new System.Drawing.Size(192, 21);
- this.txt6.TabIndex = 40;
- this.txt6.Text = "";
- //
- // label5
- //
- this.label5.Location = new System.Drawing.Point(160, 24);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(56, 16);
- this.label5.TabIndex = 37;
- this.label5.Text = "编号";
- //
- // label6
- //
- this.label6.Location = new System.Drawing.Point(288, 24);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(56, 16);
- this.label6.TabIndex = 36;
- this.label6.Text = "书名";
- //
- // label7
- //
- this.label7.Location = new System.Drawing.Point(504, 24);
- this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(56, 16);
- this.label7.TabIndex = 38;
- this.label7.Text = "类型";
- //
- // label13
- //
- this.label13.Location = new System.Drawing.Point(288, 120);
- this.label13.Name = "label13";
- this.label13.Size = new System.Drawing.Size(88, 16);
- this.label13.TabIndex = 54;
- this.label13.Text = "操作员";
- //
- // txt12
- //
- this.txt12.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataSet11, "图书信息.操作员"));
- this.txt12.Location = new System.Drawing.Point(288, 136);
- this.txt12.Name = "txt12";
- this.txt12.ReadOnly = true;
- this.txt12.Size = new System.Drawing.Size(96, 21);
- this.txt12.TabIndex = 56;
- this.txt12.Text = "";
- //
- // toolBar1
- //
- this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
- this.tBtnFirst,
- this.tBtnPre,
- this.tBtnNext,
- this.tBtnLast,
- this.tBtnNew,
- this.tBtnEdit,
- this.tBtnDelete,
- this.tBtnSubmit,
- this.tBtnCancel,
- this.tBtnQuit});
- this.toolBar1.DropDownArrows = true;
- this.toolBar1.ImageList = this.imageList1;
- this.toolBar1.Location = new System.Drawing.Point(0, 0);
- this.toolBar1.Name = "toolBar1";
- this.toolBar1.ShowToolTips = true;
- this.toolBar1.Size = new System.Drawing.Size(696, 41);
- this.toolBar1.TabIndex = 39;
- this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
- //
- // tBtnFirst
- //
- this.tBtnFirst.ImageIndex = 0;
- this.tBtnFirst.Text = "首记录";
- this.tBtnFirst.ToolTipText = "首记录";
- //
- // tBtnPre
- //
- this.tBtnPre.ImageIndex = 1;
- this.tBtnPre.Text = "上一记录";
- this.tBtnPre.ToolTipText = "上一记录";
- //
- // tBtnNext
- //
- this.tBtnNext.ImageIndex = 2;
- this.tBtnNext.Text = "下一记录";
- this.tBtnNext.ToolTipText = "下一记录";
- //
- // tBtnLast
- //
- this.tBtnLast.ImageIndex = 3;
- this.tBtnLast.Text = "尾记录";
- this.tBtnLast.ToolTipText = "尾记录";
- //
- // tBtnNew
- //
- this.tBtnNew.ImageIndex = 4;
- this.tBtnNew.Text = "新增";
- this.tBtnNew.ToolTipText = "新增";
- //
- // tBtnEdit
- //
- this.tBtnEdit.ImageIndex = 5;
- this.tBtnEdit.Text = "修改";
- this.tBtnEdit.ToolTipText = "修改";
- //
- // tBtnDelete
- //
- this.tBtnDelete.ImageIndex = 6;
- this.tBtnDelete.Text = "删除";
- this.tBtnDelete.ToolTipText = "删除";
- //
- // tBtnSubmit
- //
- this.tBtnSubmit.ImageIndex = 7;
- this.tBtnSubmit.Text = "提交";
- this.tBtnSubmit.ToolTipText = "提交";
- //
- // tBtnCancel
- //
- this.tBtnCancel.ImageIndex = 8;
- this.tBtnCancel.Text = "取消";
- this.tBtnCancel.ToolTipText = "取消";
- //
- // tBtnQuit
- //
- this.tBtnQuit.ImageIndex = 9;
- this.tBtnQuit.Text = "退出";
- this.tBtnQuit.ToolTipText = "退出";
- //
- // imageList1
- //
- this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
- this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
- this.imageList1.TransparentColor = System.Drawing.SystemColors.ControlLightLight;
- //
- // da1
- //
- this.da1.DeleteCommand = this.sqlDeleteCommand1;
- this.da1.InsertCommand = this.sqlInsertCommand1;
- this.da1.SelectCommand = this.sqlSelectCommand1;
- this.da1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
- new System.Data.Common.DataTableMapping("Table", "图书信息", new System.Data.Common.DataColumnMapping[] {
- new System.Data.Common.DataColumnMapping("条形码", "条形码"),
- new System.Data.Common.DataColumnMapping("编号", "编号"),
- new System.Data.Common.DataColumnMapping("书名", "书名"),
- new System.Data.Common.DataColumnMapping("类型", "类型"),
- new System.Data.Common.DataColumnMapping("作者", "作者"),
- new System.Data.Common.DataColumnMapping("译者", "译者"),
- new System.Data.Common.DataColumnMapping("ISBN", "ISBN"),
- new System.Data.Common.DataColumnMapping("出版社", "出版社"),
- new System.Data.Common.DataColumnMapping("价格", "价格"),
- new System.Data.Common.DataColumnMapping("页码", "页码"),
- new System.Data.Common.DataColumnMapping("书架名称", "书架名称"),
- new System.Data.Common.DataColumnMapping("现存量", "现存量"),
- new System.Data.Common.DataColumnMapping("库存总量", "库存总量"),
- new System.Data.Common.DataColumnMapping("入库时间", "入库时间"),
- new System.Data.Common.DataColumnMapping("操作员", "操作员"),
- new System.Data.Common.DataColumnMapping("简介", "简介"),
- new System.Data.Common.DataColumnMapping("借出次数", "借出次数"),
- new System.Data.Common.DataColumnMapping("是否注销", "是否注销")})});
- this.da1.UpdateCommand = this.sqlUpdateCommand1;
- //
- // sqlDeleteCommand1
- //
- this.sqlDeleteCommand1.CommandText = @"DELETE FROM 图书信息 WHERE (编号 = @Original_编号) AND (ISBN = @Original_ISBN OR @Original_ISBN IS NULL AND ISBN IS NULL) AND (书名 = @Original_书名 OR @Original_书名 IS NULL AND 书名 IS NULL) AND (书架名称 = @Original_书架名称 OR @Original_书架名称 IS NULL AND 书架名称 IS NULL) AND (价格 = @Original_价格 OR @Original_价格 IS NULL AND 价格 IS NULL) AND (作者 = @Original_作者 OR @Original_作者 IS NULL AND 作者 IS NULL) AND (借出次数 = @Original_借出次数 OR @Original_借出次数 IS NULL AND 借出次数 IS NULL) AND (入库时间 = @Original_入库时间 OR @Original_入库时间 IS NULL AND 入库时间 IS NULL) AND (出版社 = @Original_出版社 OR @Original_出版社 IS NULL AND 出版社 IS NULL) AND (库存总量 = @Original_库存总量 OR @Original_库存总量 IS NULL AND 库存总量 IS NULL) AND (操作员 = @Original_操作员 OR @Original_操作员 IS NULL AND 操作员 IS NULL) AND (是否注销 = @Original_是否注销) AND (条形码 = @Original_条形码 OR @Original_条形码 IS NULL AND 条形码 IS NULL) AND (现存量 = @Original_现存量 OR @Original_现存量 IS NULL AND 现存量 IS NULL) AND (简介 = @Original_简介 OR @Original_简介 IS NULL AND 简介 IS NULL) AND (类型 = @Original_类型 OR @Original_类型 IS NULL AND 类型 IS NULL) AND (译者 = @Original_译者 OR @Original_译者 IS NULL AND 译者 IS NULL) AND (页码 = @Original_页码 OR @Original_页码 IS NULL AND 页码 IS NULL)";
- this.sqlDeleteCommand1.Connection = this.sqlConnection1;
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_编号", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "编号", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ISBN", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ISBN", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_书名", System.Data.SqlDbType.VarChar, 200, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "书名", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_书架名称", System.Data.SqlDbType.VarChar, 200, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "书架名称", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_价格", System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "价格", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_作者", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "作者", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_借出次数", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "借出次数", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_入库时间", System.Data.SqlDbType.DateTime, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "入库时间", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_出版社", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "出版社", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_库存总量", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "库存总量", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_操作员", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "操作员", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_是否注销", System.Data.SqlDbType.Bit, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "是否注销", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_条形码", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "条形码", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_现存量", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "现存量", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_简介", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "简介", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_类型", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "类型", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_译者", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "译者", System.Data.DataRowVersion.Original, null));
- this.sqlDeleteCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_页码", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "页码", System.Data.DataRowVersion.Original, null));
- //
- // sqlConnection1
- //
- this.sqlConnection1.ConnectionString = "workstation id=localhost;Integrated Security=SSPI;Database=libbook;";
- //
- // sqlInsertCommand1
- //
- this.sqlInsertCommand1.CommandText = @"INSERT INTO 图书信息(条形码, 编号, 书名, 类型, 作者, 译者, ISBN, 出版社, 价格, 页码, 书架名称, 现存量, 库存总量, 入库时间, 操作员, 简介, 借出次数, 是否注销) VALUES (@条形码, @编号, @书名, @类型, @作者, @译者, @ISBN, @出版社, @价格, @页码, @书架名称, @现存量, @库存总量, @入库时间, @操作员, @简介, @借出次数, @是否注销); SELECT 条形码, 编号, 书名, 类型, 作者, 译者, ISBN, 出版社, 价格, 页码, 书架名称, 现存量, 库存总量, 入库时间, 操作员, 简介, 借出次数, 是否注销 FROM 图书信息 WHERE (编号 = @编号)";
- this.sqlInsertCommand1.Connection = this.sqlConnection1;
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@条形码", System.Data.SqlDbType.VarChar, 40, "条形码"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@编号", System.Data.SqlDbType.VarChar, 50, "编号"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@书名", System.Data.SqlDbType.VarChar, 200, "书名"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@类型", System.Data.SqlDbType.VarChar, 100, "类型"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@作者", System.Data.SqlDbType.VarChar, 100, "作者"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@译者", System.Data.SqlDbType.VarChar, 100, "译者"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ISBN", System.Data.SqlDbType.VarChar, 40, "ISBN"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@出版社", System.Data.SqlDbType.VarChar, 100, "出版社"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@价格", System.Data.SqlDbType.Money, 8, "价格"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@页码", System.Data.SqlDbType.Int, 4, "页码"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@书架名称", System.Data.SqlDbType.VarChar, 200, "书架名称"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@现存量", System.Data.SqlDbType.Int, 4, "现存量"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@库存总量", System.Data.SqlDbType.Int, 4, "库存总量"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@入库时间", System.Data.SqlDbType.DateTime, 4, "入库时间"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@操作员", System.Data.SqlDbType.VarChar, 20, "操作员"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@简介", System.Data.SqlDbType.VarChar, 100, "简介"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@借出次数", System.Data.SqlDbType.Int, 4, "借出次数"));
- this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@是否注销", System.Data.SqlDbType.Bit, 1, "是否注销"));
- //
- // sqlSelectCommand1
- //
- this.sqlSelectCommand1.CommandText = "SELECT 条形码, 编号, 书名, 类型, 作者, 译者, ISBN, 出版社, 价格, 页码, 书架名称, 现存量, 库存总量, 入库时间, 操作员, 简介" +
- ", 借出次数, 是否注销 FROM 图书信息 WHERE (条形码 LIKE @Param4) AND (编号 LIKE @Param5) AND (书名 LI" +
- "KE @Param6)";
- this.sqlSelectCommand1.Connection = this.sqlConnection1;
- this.sqlSelectCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param4", System.Data.SqlDbType.VarChar, 40, "条形码"));
- this.sqlSelectCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param5", System.Data.SqlDbType.VarChar, 50, "编号"));
- this.sqlSelectCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Param6", System.Data.SqlDbType.VarChar, 200, "书名"));
- //
- // sqlUpdateCommand1
- //
- this.sqlUpdateCommand1.CommandText = @"UPDATE 图书信息 SET 条形码 = @条形码, 编号 = @编号, 书名 = @书名, 类型 = @类型, 作者 = @作者, 译者 = @译者, ISBN = @ISBN, 出版社 = @出版社, 价格 = @价格, 页码 = @页码, 书架名称 = @书架名称, 现存量 = @现存量, 库存总量 = @库存总量, 入库时间 = @入库时间, 操作员 = @操作员, 简介 = @简介, 借出次数 = @借出次数, 是否注销 = @是否注销 WHERE (编号 = @Original_编号) AND (ISBN = @Original_ISBN OR @Original_ISBN IS NULL AND ISBN IS NULL) AND (书名 = @Original_书名 OR @Original_书名 IS NULL AND 书名 IS NULL) AND (书架名称 = @Original_书架名称 OR @Original_书架名称 IS NULL AND 书架名称 IS NULL) AND (价格 = @Original_价格 OR @Original_价格 IS NULL AND 价格 IS NULL) AND (作者 = @Original_作者 OR @Original_作者 IS NULL AND 作者 IS NULL) AND (借出次数 = @Original_借出次数 OR @Original_借出次数 IS NULL AND 借出次数 IS NULL) AND (入库时间 = @Original_入库时间 OR @Original_入库时间 IS NULL AND 入库时间 IS NULL) AND (出版社 = @Original_出版社 OR @Original_出版社 IS NULL AND 出版社 IS NULL) AND (库存总量 = @Original_库存总量 OR @Original_库存总量 IS NULL AND 库存总量 IS NULL) AND (操作员 = @Original_操作员 OR @Original_操作员 IS NULL AND 操作员 IS NULL) AND (是否注销 = @Original_是否注销) AND (条形码 = @Original_条形码 OR @Original_条形码 IS NULL AND 条形码 IS NULL) AND (现存量 = @Original_现存量 OR @Original_现存量 IS NULL AND 现存量 IS NULL) AND (简介 = @Original_简介 OR @Original_简介 IS NULL AND 简介 IS NULL) AND (类型 = @Original_类型 OR @Original_类型 IS NULL AND 类型 IS NULL) AND (译者 = @Original_译者 OR @Original_译者 IS NULL AND 译者 IS NULL) AND (页码 = @Original_页码 OR @Original_页码 IS NULL AND 页码 IS NULL); SELECT 条形码, 编号, 书名, 类型, 作者, 译者, ISBN, 出版社, 价格, 页码, 书架名称, 现存量, 库存总量, 入库时间, 操作员, 简介, 借出次数, 是否注销 FROM 图书信息 WHERE (编号 = @编号)";
- this.sqlUpdateCommand1.Connection = this.sqlConnection1;
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@条形码", System.Data.SqlDbType.VarChar, 40, "条形码"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@编号", System.Data.SqlDbType.VarChar, 50, "编号"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@书名", System.Data.SqlDbType.VarChar, 200, "书名"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@类型", System.Data.SqlDbType.VarChar, 100, "类型"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@作者", System.Data.SqlDbType.VarChar, 100, "作者"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@译者", System.Data.SqlDbType.VarChar, 100, "译者"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ISBN", System.Data.SqlDbType.VarChar, 40, "ISBN"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@出版社", System.Data.SqlDbType.VarChar, 100, "出版社"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@价格", System.Data.SqlDbType.Money, 8, "价格"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@页码", System.Data.SqlDbType.Int, 4, "页码"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@书架名称", System.Data.SqlDbType.VarChar, 200, "书架名称"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@现存量", System.Data.SqlDbType.Int, 4, "现存量"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@库存总量", System.Data.SqlDbType.Int, 4, "库存总量"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@入库时间", System.Data.SqlDbType.DateTime, 4, "入库时间"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@操作员", System.Data.SqlDbType.VarChar, 20, "操作员"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@简介", System.Data.SqlDbType.VarChar, 100, "简介"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@借出次数", System.Data.SqlDbType.Int, 4, "借出次数"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@是否注销", System.Data.SqlDbType.Bit, 1, "是否注销"));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_编号", System.Data.SqlDbType.VarChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "编号", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_ISBN", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ISBN", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_书名", System.Data.SqlDbType.VarChar, 200, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "书名", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_书架名称", System.Data.SqlDbType.VarChar, 200, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "书架名称", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_价格", System.Data.SqlDbType.Money, 8, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "价格", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_作者", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "作者", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_借出次数", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "借出次数", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_入库时间", System.Data.SqlDbType.DateTime, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "入库时间", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_出版社", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "出版社", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_库存总量", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "库存总量", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_操作员", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "操作员", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_是否注销", System.Data.SqlDbType.Bit, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "是否注销", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_条形码", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "条形码", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_现存量", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "现存量", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_简介", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "简介", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_类型", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "类型", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_译者", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "译者", System.Data.DataRowVersion.Original, null));
- this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_页码", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "页码", System.Data.DataRowVersion.Original, null));
- //
- // BookInfo
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
- this.ClientSize = new System.Drawing.Size(696, 517);
- this.Controls.Add(this.groupBox2);
- this.Controls.Add(this.dataGrid1);
- this.Controls.Add(this.groupBox1);
- this.Controls.Add(this.toolBar1);
- this.Name = "BookInfo";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "【图书档案管理】";
- this.Load += new System.EventHandler(this.BookInfo_Load);
- ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
- this.groupBox1.ResumeLayout(false);
- this.groupBox2.ResumeLayout(false);
- this.ResumeLayout(false);
- }
- #endregion
- //------------创建窗体时读入数据和设置下拉列表------------
- private void BookInfo_Load(object sender, System.EventArgs e)
- {
- da1.SelectCommand.Parameters[0].Value="%%";
- da1.SelectCommand.Parameters[1].Value="%%";
- da1.SelectCommand.Parameters[2].Value="%%";
- da1.Fill(dataSet11);
- //绑定数据导航
- cmOrders=(CurrencyManager) BindingContext[dataSet11,"图书信息"];
- //设置【出版社】,【书架名称】,【类型】三个下拉列表框设置下拉列表
- setCombo("select distinct 类型名称 from 图书类型",cmb1);
- setCombo("select distinct 出版社名称 from 出版社",cmb2);
- setCombo("select distinct 书架名称 from 书架",cmb3);
- }
- //-------------输入sql语句和列表框,设置下拉选项-------------
- private void setCombo(string sql,ComboBox cmb)
- {
- //清空下拉列表
- cmb.Items.Clear();
- string strConn = "workstation id=localhost;Integrated Security=SSPI;database=libbook";
- SqlConnection cn=new SqlConnection(strConn);
- cn.Open();
- SqlCommand cmd=cn.CreateCommand();
- cmd.CommandText=sql;
- SqlDataReader dr=cmd.ExecuteReader();
- while(dr.Read())
- {
- cmb.Items.Add(dr.GetValue(0).ToString().Trim());
- }
- }
- //----------根据输入的信息,查询读者信息--------
- private void btnSearch_Click(object sender, System.EventArgs e)
- {
- da1.SelectCommand.Parameters[0].Value="%%";
- da1.SelectCommand.Parameters[1].Value="%%";
- da1.SelectCommand.Parameters[2].Value="%%";
- if(txt1.Text!="")
- {
- da1.SelectCommand.Parameters[0].Value="%"+txt1.Text+"%";
- }
- if(txt2.Text!="")
- {
- da1.SelectCommand.Parameters[1].Value="%"+txt2.Text+"%";
- }
- if(txt3.Text!="")
- {
- da1.SelectCommand.Parameters[2].Value="%"+txt3.Text+"%";
- }
- dataSet11.图书信息.Clear();
- da1.Fill(dataSet11);
- }
- //---------------工具栏事务处理----------------
- private void toolBar1_ButtonClick(object sender, System.Windows.Forms.ToolBarButtonClickEventArgs e)
- {
- if (e.Button.ToolTipText == "首记录")
- {
- this.dataGrid1.UnSelect(cmOrders.Position); //取消原选中的行
- cmOrders.Position = 0;
- this.dataGrid1.Select(cmOrders.Position); //选中当前行
- this.dataGrid1.CurrentRowIndex = cmOrders.Position; //移动表头指示图标
- return;
- }
- if (e.Button.ToolTipText == "上一记录")
- {
- if (cmOrders.Position >= 0)
- {
- this.dataGrid1.UnSelect(cmOrders.Position);
- cmOrders.Position--;
- this.dataGrid1.Select(cmOrders.Position);
- this.dataGrid1.CurrentRowIndex = cmOrders.Position;
- }
- return;
- }
- if (e.Button.ToolTipText == "下一记录")
- {
- if (cmOrders.Position <= cmOrders.Count-1)
- {
- this.dataGrid1.UnSelect(cmOrders.Position);
- cmOrders.Position++;
- this.dataGrid1.Select(cmOrders.Position);
- this.dataGrid1.CurrentRowIndex = cmOrders.Position;
- }
- return;
- }
- if (e.Button.ToolTipText == "尾记录")
- {
- this.dataGrid1.UnSelect(cmOrders.Position);
- cmOrders.Position = cmOrders.Count-1;
- this.dataGrid1.Select(cmOrders.Position);
- this.dataGrid1.CurrentRowIndex = cmOrders.Position;
- return;
- }
- if(e.Button.ToolTipText=="新增")
- {
- cmOrders.AddNew();
- //设置默认值
- SetDefaultValue();
- SetModifyMode(true);
- }
- if(e.Button.ToolTipText=="修改")
- {
- SetModifyMode(true);
- }
- if(e.Button.ToolTipText=="删除")
- {
- DialogResult result=MessageBox.Show("确认删除?","删除数据",MessageBoxButtons.OKCancel);
- if(result==DialogResult.OK)
- if(cmOrders.Count>0)//立即从数据集中删除
- {
- cmOrders.RemoveAt(cmOrders.Position);
- da1.Update(dataSet11);
- }
- else
- MessageBox.Show("表中为空,已无可删除数据","提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
- }
- if(e.Button.ToolTipText=="提交")
- {
- if(txt4.Text.Trim()=="")//检查字段
- {
- MessageBox.Show("请输入条形码","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning);
- return;
- }
- if(txt6.Text.Trim()=="")
- {
- MessageBox.Show("请输入书名","提示",MessageBoxButtons.OK,MessageBoxIcon.Warning);
- return;
- }
- cmOrders.EndCurrentEdit();
- if(dataSet11.GetChanges()!=null)
- {
- try
- {
- da1.Update(dataSet11);
- SetModifyMode(false);
- }
- catch(Exception express)
- {
- MessageBox.Show(express.ToString(),"提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
- dataSet11.RejectChanges();
- }
- }
- return;
- }
- if (e.Button.ToolTipText == "取消")
- {
- try
- {
- cmOrders.CancelCurrentEdit(); //取消编辑
- SetModifyMode(false);
- }
- catch(Exception express)
- {
- MessageBox.Show(express.ToString(),"提示",MessageBoxButtons.OK,MessageBoxIcon.Error);
- }
- return;
- }
- if(e.Button.ToolTipText=="退出")
- {
- this.Close();
- }
- }
- //--------------对控件的属性做设置---------------
- private void SetModifyMode(bool blnEdit)
- {
- //设置文本框和下拉列表框属性
- txt4.ReadOnly=!blnEdit;
- txt5.ReadOnly=!blnEdit;
- txt6.ReadOnly=!blnEdit;
- txt7.ReadOnly=!blnEdit;
- txt8.ReadOnly=!blnEdit;
- txt9.ReadOnly=!blnEdit;
- txt10.ReadOnly=!blnEdit;
- txt11.ReadOnly=!blnEdit;
- txt12.ReadOnly=!blnEdit;
- txt13.ReadOnly=!blnEdit;
- cmb1.Enabled=blnEdit;
- cmb2.Enabled=blnEdit;
- cmb3.Enabled=blnEdit;
- checkBox1.Enabled=blnEdit;
- //设置搜索按钮属性
- btnSearch.Enabled=!blnEdit;
- }
- //------------在新增数据时,设置默认值--------------
- private void SetDefaultValue()
- {
- string strConn = "workstation id=localhost;Integrated Security=SSPI;database=libbook";
- SqlConnection cn=new SqlConnection(strConn);
- cn.Open();
- SqlCommand cmd=cn.CreateCommand();
- cmd.CommandText="select max(编号) 最大编号 from 图书信息";
- int maxID=1;//计算新编号
- object result=cmd.ExecuteScalar();
- if(result!=System.DBNull.Value)
- {
- maxID=Convert.ToInt32(result)+1;
- }
- int length=maxID.ToString().Length;
- switch(length)//生成新的编码
- {
- case 1:
- txt5.Text="000000"+maxID.ToString();
- break;
- case 2:
- txt5.Text="00000"+maxID.ToString();
- break;
- case 3:
- txt5.Text="0000"+maxID.ToString();
- break;
- case 4:
- txt5.Text="000"+maxID.ToString();
- break;
- case 5:
- txt5.Text="00"+maxID.ToString();
- break;
- case 6:
- txt5.Text="0"+maxID.ToString();
- break;
- }
- }
- }
- }