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

📄 usercontrol1.cs

📁 图书管理系统,.net2003+sql2000,分为三个模块,用户端,操作员端,系统管理员端.基本上是用自定义控件dll来完成,内含完整sql语句,包括存储过程.
💻 CS
📖 第 1 页 / 共 2 页
字号:
			this.label8.Text = "馆藏地";
			// 
			// label7
			// 
			this.label7.Location = new System.Drawing.Point(224, 32);
			this.label7.Name = "label7";
			this.label7.Size = new System.Drawing.Size(64, 23);
			this.label7.TabIndex = 3;
			this.label7.Text = "索取号";
			// 
			// label6
			// 
			this.label6.Location = new System.Drawing.Point(16, 32);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(64, 23);
			this.label6.TabIndex = 2;
			this.label6.Text = "条码号";
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(344, 176);
			this.button1.Name = "button1";
			this.button1.TabIndex = 2;
			this.button1.Text = "确定";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(424, 176);
			this.button2.Name = "button2";
			this.button2.TabIndex = 3;
			this.button2.Text = "取消";
			// 
			// button3
			// 
			this.button3.Location = new System.Drawing.Point(424, 136);
			this.button3.Name = "button3";
			this.button3.TabIndex = 3;
			this.button3.Text = "取消";
			// 
			// button4
			// 
			this.button4.Location = new System.Drawing.Point(344, 136);
			this.button4.Name = "button4";
			this.button4.TabIndex = 2;
			this.button4.Text = "确定";
			this.button4.Click += new System.EventHandler(this.button4_Click);
			// 
			// comboBox3
			// 
			this.comboBox3.Items.AddRange(new object[] {
														   "在馆",
														   "............归还"});
			this.comboBox3.Location = new System.Drawing.Point(104, 96);
			this.comboBox3.Name = "comboBox3";
			this.comboBox3.Size = new System.Drawing.Size(136, 20);
			this.comboBox3.TabIndex = 10;
			this.comboBox3.Text = "在馆";
			// 
			// button5
			// 
			this.button5.Location = new System.Drawing.Point(184, 176);
			this.button5.Name = "button5";
			this.button5.TabIndex = 11;
			this.button5.Text = "修改";
			this.button5.Click += new System.EventHandler(this.button5_Click);
			// 
			// button6
			// 
			this.button6.Location = new System.Drawing.Point(264, 176);
			this.button6.Name = "button6";
			this.button6.TabIndex = 12;
			this.button6.Text = "删除";
			this.button6.Click += new System.EventHandler(this.button6_Click);
			// 
			// button7
			// 
			this.button7.Location = new System.Drawing.Point(184, 136);
			this.button7.Name = "button7";
			this.button7.TabIndex = 11;
			this.button7.Text = "修改";
			this.button7.Click += new System.EventHandler(this.button7_Click);
			// 
			// button8
			// 
			this.button8.Location = new System.Drawing.Point(264, 136);
			this.button8.Name = "button8";
			this.button8.TabIndex = 12;
			this.button8.Text = "删除";
			this.button8.Click += new System.EventHandler(this.button8_Click);
			// 
			// UserControl1
			// 
			this.Controls.Add(this.groupBox2);
			this.Controls.Add(this.groupBox1);
			this.Name = "UserControl1";
			this.Size = new System.Drawing.Size(576, 440);
			this.groupBox1.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void button1_Click(object sender, System.EventArgs e)//增加书目
		{
			try
			{
				if(textBox1.Text=="")
				{
					MessageBox.Show("该列不能为空!");
					return;
				}
				公共数据dll.Store.cn.Open();
				公共数据dll.Store.sqlStr="insert into book values('"+textBox1.Text+"','"+textBox2.Text+"','"+textBox3.Text+"','"+textBox4.Text+"','"+textBox5.Text+"')";
				公共数据dll.Store.cmd=new System.Data.SqlClient.SqlCommand(公共数据dll.Store.sqlStr,公共数据dll.Store.cn);
				if(公共数据dll.Store.cmd.ExecuteNonQuery()==1)
				{
					MessageBox.Show("建立一条图书记录成功!");
				}
				公共数据dll.Store.cn.Close();
			}
			catch(Exception E)
			{
				MessageBox.Show(E.Message);
				公共数据dll.Store.cn.Close();
			}
		}
		private void button5_Click(object sender, System.EventArgs e)//修改书目
		{
			try
			{
				if(textBox1.Text=="")
				{
					MessageBox.Show("该列不能为空!");
					return;
				}

				公共数据dll.Store.cn.Open();
				公共数据dll.Store.sqlStr="update  book set 索取号='"+textBox1.Text+"', 题名='"+textBox2.Text+"',著者='"+textBox3.Text+"',出版信息='"+textBox4.Text+"',附注项='"+textBox5.Text+"'where 索取号='"+textBox1.Text+"'";
				公共数据dll.Store.cmd=new System.Data.SqlClient.SqlCommand(公共数据dll.Store.sqlStr,公共数据dll.Store.cn);
				if(公共数据dll.Store.cmd.ExecuteNonQuery()==1)
				{
					MessageBox.Show("修改一条图书记录成功!");
				}
				公共数据dll.Store.cn.Close();
			}
			catch(Exception E)
			{
				MessageBox.Show(E.Message);
				公共数据dll.Store.cn.Close();
			}
			
		}

		private void button6_Click(object sender, System.EventArgs e)//删除该条图书记录
		{
			
			try
			{
				公共数据dll.Store.cn.Open();
				公共数据dll.Store.sqlStr="delete from  book where  索取号='"+textBox1.Text+"'";
				DialogResult re= MessageBox.Show("警告:你将删除图书:'"+textBox1.Text+"'的所有信息!","Msg",MessageBoxButtons.OKCancel,MessageBoxIcon.Information);
				if(re==DialogResult.OK)
				{
					公共数据dll.Store.cmd=new System.Data.SqlClient.SqlCommand(公共数据dll.Store.sqlStr,公共数据dll.Store.cn);
					if(公共数据dll.Store.cmd.ExecuteNonQuery()==1)
					{
						MessageBox.Show("建立一条图书记录成功!");
					}
				}
				公共数据dll.Store.cn.Close();
			}
			catch(Exception E)
			{
				MessageBox.Show(E.Message);
				公共数据dll.Store.cn.Close();
			}
		
		}
		private void button4_Click(object sender, System.EventArgs e)//增加书目相关
		{
			try
			{
				if(textBox6.Text=="")
				{
					MessageBox.Show("该列不能为空!");
					return;
				}

				公共数据dll.Store.cn.Open();
				公共数据dll.Store.sqlStr="insert into bookindex values('"+textBox6.Text+"','"+textBox7.Text+"','"+comboBox1.Text+"','"+comboBox2.Text+"','"+comboBox3.Text+"')";
				公共数据dll.Store.cmd=new System.Data.SqlClient.SqlCommand(公共数据dll.Store.sqlStr,公共数据dll.Store.cn);
				if(公共数据dll.Store.cmd.ExecuteNonQuery()==1)
				{
					MessageBox.Show("建立一条图书相关记录成功!");
				}
				公共数据dll.Store.cn.Close();
			}
			catch(Exception E)
			{
				MessageBox.Show(E.Message);
				公共数据dll.Store.cn.Close();
			}
		
		}

		private void button7_Click(object sender, System.EventArgs e)//修改书目相关
		{
			try
			{
				if(textBox6.Text=="")
				{
					MessageBox.Show("该列不能为空!");
					return;
				}

				公共数据dll.Store.cn.Open();
				公共数据dll.Store.sqlStr="update bookindex set 条码号='"+textBox6.Text+"',索取号='"+textBox7.Text+"',馆藏地='"+comboBox1.Text+"',书刊状态='"+comboBox2.Text+"',书刊借阅状态='"+comboBox3.Text+"' where 条码号='"+textBox6.Text+"'";
				公共数据dll.Store.cmd=new System.Data.SqlClient.SqlCommand(公共数据dll.Store.sqlStr,公共数据dll.Store.cn);
				if(公共数据dll.Store.cmd.ExecuteNonQuery()==1)
				{
					MessageBox.Show("修改一条图书相关记录成功!");
				}
				公共数据dll.Store.cn.Close();
			}
			catch(Exception E)
			{
				MessageBox.Show(E.Message);
				公共数据dll.Store.cn.Close();
			}
			
		}

		private void button8_Click(object sender, System.EventArgs e)//删除书目相关
		{
			try
			{
				公共数据dll.Store.cn.Open();
				公共数据dll.Store.sqlStr="delete  from bookindex where  条码号='"+textBox6.Text+"'";
				DialogResult re= MessageBox.Show("警告:你将删除图书相关:'"+textBox6.Text+"'的所有信息!","Msg",MessageBoxButtons.OKCancel,MessageBoxIcon.Information);
				if(re==DialogResult.OK)
				{
					公共数据dll.Store.cmd=new System.Data.SqlClient.SqlCommand(公共数据dll.Store.sqlStr,公共数据dll.Store.cn);
					if(公共数据dll.Store.cmd.ExecuteNonQuery()==1)
					{
						MessageBox.Show("删除一条图书相关记录成功!");
					}
				}
				公共数据dll.Store.cn.Close();
			}
			catch(Exception E)
			{
				MessageBox.Show(E.Message);
				公共数据dll.Store.cn.Close();
			}
			
		}

		private void textBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)//在textBox1回车查询book
		{
			if(e.KeyValue==13)
			{
				公共数据dll.Store.cn.Open();
				公共数据dll.Store.sqlStr="select * from book where 索取号='"+textBox1.Text+"'";
				公共数据dll.Store.cmd=new System.Data.SqlClient.SqlCommand(公共数据dll.Store.sqlStr,公共数据dll.Store.cn);
				公共数据dll.Store.dr=公共数据dll.Store.cmd.ExecuteReader();
				while(公共数据dll.Store.dr.Read())
				{
					textBox2.Text=公共数据dll.Store.dr["题名"].ToString();
					textBox3.Text=公共数据dll.Store.dr["著者"].ToString();
					textBox4.Text=公共数据dll.Store.dr["出版信息"].ToString();
					textBox5.Text=公共数据dll.Store.dr["附注项"].ToString();
				}
				公共数据dll.Store.cn.Close();
			}
		}

		private void textBox6_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)//在textBox6回车查询bookindex
		{
			if(e.KeyValue==13)
			{
				公共数据dll.Store.cn.Open();
				公共数据dll.Store.sqlStr="select * from bookindex where 条码号='"+textBox6.Text+"'";
				公共数据dll.Store.cmd=new System.Data.SqlClient.SqlCommand(公共数据dll.Store.sqlStr,公共数据dll.Store.cn);
				公共数据dll.Store.dr=公共数据dll.Store.cmd.ExecuteReader();
				while(公共数据dll.Store.dr.Read())
				{
					textBox7.Text=公共数据dll.Store.dr["索取号"].ToString();
					comboBox1.Text=公共数据dll.Store.dr["馆藏地"].ToString();
					comboBox2.Text=公共数据dll.Store.dr["书刊状态"].ToString();
					comboBox3.Text=公共数据dll.Store.dr["书刊借阅状态"].ToString();
				}
				公共数据dll.Store.cn.Close();
			}		
		}


	}
}

⌨️ 快捷键说明

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