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

📄 selinstg.cs

📁 物流行业的仓库库存管理系统DOTNET平台下的源码
💻 CS
📖 第 1 页 / 共 2 页
字号:
			this.InStgAdapter.DeleteCommand = this.sqlDeleteCommand1;
			this.InStgAdapter.InsertCommand = this.sqlInsertCommand1;
			this.InStgAdapter.SelectCommand = this.sqlSelectCommand1;
			this.InStgAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
																								   new System.Data.Common.DataTableMapping("Table", "storage_In", 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.InStgAdapter.UpdateCommand = this.sqlUpdateCommand1;
			// 
			// sqlDeleteCommand1
			// 
			this.sqlDeleteCommand1.CommandText = @"DELETE FROM storage_In WHERE (设备号 = @Original_设备号) 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_数量) 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, 10, 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, 10, 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, 10, 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, 10, 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, 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, 10, 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, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "采购员", System.Data.DataRowVersion.Original, null));
			// 
			// sqlConnection1
			// 
			this.sqlConnection1.ConnectionString = "workstation id=727CE26111204C4;packet size=4096;user id=sa;data source=\".\";persis" +
				"t security info=False;initial catalog=storage";
			// 
			// sqlInsertCommand1
			// 
			this.sqlInsertCommand1.CommandText = "INSERT INTO storage_In(设备号, 入库日期, 供应商, 供应商电话, 数量, 价格, 采购员) VALUES (@设备号, @入库日期, @" +
				"供应商, @供应商电话, @数量, @价格, @采购员); SELECT 设备号, 入库日期, 供应商, 供应商电话, 数量, 价格, 采购员 FROM sto" +
				"rage_In WHERE (设备号 = @设备号)";
			this.sqlInsertCommand1.Connection = this.sqlConnection1;
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@设备号", System.Data.SqlDbType.VarChar, 10, "设备号"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@入库日期", System.Data.SqlDbType.DateTime, 8, "入库日期"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@供应商", System.Data.SqlDbType.VarChar, 10, "供应商"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@供应商电话", System.Data.SqlDbType.VarChar, 10, "供应商电话"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@数量", System.Data.SqlDbType.VarChar, 10, "数量"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@价格", System.Data.SqlDbType.VarChar, 10, "价格"));
			this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@采购员", System.Data.SqlDbType.VarChar, 10, "采购员"));
			// 
			// sqlSelectCommand1
			// 
			this.sqlSelectCommand1.CommandText = "SELECT 设备号, 入库日期, 供应商, 供应商电话, 数量, 价格, 采购员 FROM storage_In";
			this.sqlSelectCommand1.Connection = this.sqlConnection1;
			// 
			// sqlUpdateCommand1
			// 
			this.sqlUpdateCommand1.CommandText = @"UPDATE storage_In SET 设备号 = @设备号, 入库日期 = @入库日期, 供应商 = @供应商, 供应商电话 = @供应商电话, 数量 = @数量, 价格 = @价格, 采购员 = @采购员 WHERE (设备号 = @Original_设备号) 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_数量) AND (采购员 = @Original_采购员 OR @Original_采购员 IS NULL AND 采购员 IS NULL); SELECT 设备号, 入库日期, 供应商, 供应商电话, 数量, 价格, 采购员 FROM storage_In WHERE (设备号 = @设备号)";
			this.sqlUpdateCommand1.Connection = this.sqlConnection1;
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@设备号", System.Data.SqlDbType.VarChar, 10, "设备号"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@入库日期", System.Data.SqlDbType.DateTime, 8, "入库日期"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@供应商", System.Data.SqlDbType.VarChar, 10, "供应商"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@供应商电话", System.Data.SqlDbType.VarChar, 10, "供应商电话"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@数量", System.Data.SqlDbType.VarChar, 10, "数量"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@价格", System.Data.SqlDbType.VarChar, 10, "价格"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@采购员", System.Data.SqlDbType.VarChar, 10, "采购员"));
			this.sqlUpdateCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_设备号", System.Data.SqlDbType.VarChar, 10, 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, 10, 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, 10, 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, 10, 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, 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, 10, 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, 10, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "采购员", System.Data.DataRowVersion.Original, null));
			// 
			// SelInStg
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(480, 318);
			this.Controls.Add(this.dataGrid1);
			this.Controls.Add(this.groupBox1);
			this.Name = "SelInStg";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "入库信息查询";
			this.Load += new System.EventHandler(this.SelInStg_Load);
			this.groupBox1.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion
		private void SelInStg_Load(object sender, System.EventArgs e)
		{
			try
			{
				this.sqlConnection1.ConnectionString= "server=.;Trusted_Connection=yes;user=sa;pwd=1;database=storage";//建立连接
				this.sqlConnection1.Open();
				DataSet InStgSet=new DataSet();
				InStgAdapter.SelectCommand.CommandText="SELECT * FROM storage_In";
				InStgAdapter.SelectCommand.Connection=sqlConnection1;
				InStgAdapter.Fill(InStgInfo);
				DataGridTableStyle instg = new DataGridTableStyle();
				instg.AlternatingBackColor = Color.Blue;//颜色设置
				instg.MappingName = InStgInfo.TableName;
			}
			catch(Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
			finally
			{
			}
		}

		private void sel_button1_Click(object sender, System.EventArgs e)
		{
			string condition = "";
			if(this.textNum.Text.Trim() != "")//设置表的过滤条件
			{
				condition += "设备号 like '%" + textNum.Text.Trim()  + "%'";
				if(this.textSupply.Text.Trim() != "")
				{
					condition += "and 供应商 like '%" + textSupply.Text.Trim() + "%" + "'";
				}
			}
			else
			{
				if(this.textSupply.Text.Trim()!="")
				{
					condition += "供应商 like '%" + textSupply.Text.Trim()  + "%'";
				}
				else
				{
					MessageBox.Show("请输入查询条件");
					return;
				}

			}
			InStgInfo.DefaultView.RowFilter=condition;
            this.dataGrid1.DataSource = InStgInfo.DefaultView;
			if(this.dataGrid1.VisibleRowCount==1)//判断检索条件是否与记录匹配
			{
				MessageBox.Show("对不起,入库数据中没有与您检索条件相匹配的记录!");
				return;
			}
			this.textNum.Clear();
			this.textSupply.Clear();
		}

		private void textNum_TextChanged(object sender, System.EventArgs e)
		{
		
		}

				
			}
			
	}

⌨️ 快捷键说明

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