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

📄 storagesearch.cs

📁 进销存管理系统软件
💻 CS
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace my进销售
{
	/// <summary>
	/// StorageSearch 的摘要说明。
	/// </summary>
	public class StorageSearch : System.Windows.Forms.Form
	{
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.DataGrid dataGrid1;
		private DataSet ds=new DataSet();
		private DataView dv;
		private Database link=new Database();





		private string sendtablename="库存商品";
		private string sendsql="select 库存库.货号,拼音编码,品名,单位,仓库,库存数量,库存单价 from 库存库,商品清单 where 库存库.货号=商品清单.货号";
		private System.Windows.Forms.ComboBox data_list;
		private System.Windows.Forms.TextBox txt_qd;
		private System.Windows.Forms.TextBox txt_hh;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public StorageSearch()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			this.select();



			//
			// 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.groupBox1 = new System.Windows.Forms.GroupBox();
			this.button1 = new System.Windows.Forms.Button();
			this.data_list = new System.Windows.Forms.ComboBox();
			this.label3 = new System.Windows.Forms.Label();
			this.txt_qd = new System.Windows.Forms.TextBox();
			this.label2 = new System.Windows.Forms.Label();
			this.label1 = new System.Windows.Forms.Label();
			this.txt_hh = new System.Windows.Forms.TextBox();
			this.dataGrid1 = new System.Windows.Forms.DataGrid();
			this.groupBox1.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
			this.SuspendLayout();
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.button1);
			this.groupBox1.Controls.Add(this.data_list);
			this.groupBox1.Controls.Add(this.label3);
			this.groupBox1.Controls.Add(this.txt_qd);
			this.groupBox1.Controls.Add(this.label2);
			this.groupBox1.Controls.Add(this.label1);
			this.groupBox1.Controls.Add(this.txt_hh);
			this.groupBox1.Location = new System.Drawing.Point(0, 0);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(704, 40);
			this.groupBox1.TabIndex = 0;
			this.groupBox1.TabStop = false;
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(575, 16);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(40, 24);
			this.button1.TabIndex = 6;
			this.button1.Text = "查询";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// data_list
			// 
			this.data_list.Location = new System.Drawing.Point(433, 16);
			this.data_list.Name = "data_list";
			this.data_list.Size = new System.Drawing.Size(113, 20);
			this.data_list.TabIndex = 5;
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(376, 16);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(32, 16);
			this.label3.TabIndex = 4;
			this.label3.Text = "仓库";
			// 
			// txt_qd
			// 
			this.txt_qd.Location = new System.Drawing.Point(256, 10);
			this.txt_qd.Name = "txt_qd";
			this.txt_qd.Size = new System.Drawing.Size(91, 21);
			this.txt_qd.TabIndex = 3;
			this.txt_qd.Text = "";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(181, 12);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(59, 16);
			this.label2.TabIndex = 2;
			this.label2.Text = "商品清单";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(16, 16);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(40, 16);
			this.label1.TabIndex = 1;
			this.label1.Text = "货号";
			// 
			// txt_hh
			// 
			this.txt_hh.Location = new System.Drawing.Point(67, 8);
			this.txt_hh.Name = "txt_hh";
			this.txt_hh.Size = new System.Drawing.Size(85, 21);
			this.txt_hh.TabIndex = 0;
			this.txt_hh.Text = "";
			// 
			// dataGrid1
			// 
			this.dataGrid1.CaptionBackColor = System.Drawing.SystemColors.AppWorkspace;
			this.dataGrid1.DataMember = "";
			this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.dataGrid1.Location = new System.Drawing.Point(0, 40);
			this.dataGrid1.Name = "dataGrid1";
			this.dataGrid1.Size = new System.Drawing.Size(712, 288);
			this.dataGrid1.TabIndex = 1;
			// 
			// StorageSearch
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(712, 316);
			this.Controls.Add(this.dataGrid1);
			this.Controls.Add(this.groupBox1);
			this.Name = "StorageSearch";
			this.Text = "[库存查询]";
			this.groupBox1.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		private void button1_Click(object sender, System.EventArgs e)
		{
			string strrowfileter="";
			string sqlhh="货号 like '"+txt_hh.Text.Trim() + "%'";
			string qd="拼音编码 like '"+txt_qd.Text.Trim() + "%'";
			int intsum=this.data_list.SelectedIndex;
			string cc="仓库='"+this.data_list.Items[intsum].ToString().Trim()+"%'";
			if(txt_hh.Text!="")
				strrowfileter+=strrowfileter+" and ";
			if(txt_qd.Text!="")
				strrowfileter+=strrowfileter+" and ";
			if(this.data_list.Items[intsum].ToString().Trim()!="")
                strrowfileter+=strrowfileter+" and ";
			if(strrowfileter!="")
                strrowfileter=strrowfileter.Substring(0,strrowfileter.Length-5);
			dv.RowFilter= strrowfileter;
                   
		
		}


		public void select()

		{
			this.ds=this.link.selectdata(sendtablename,sendsql);
			this.dv=new DataView(ds.Tables[0]);
			this.dataGrid1.DataSource=dv;
		    this.data_list.Items.Add("");
			for(int i=0;i<ds.Tables[0].Rows.Count;i++)
			{
				for(int j=0;j<this.data_list.Items.Count;j++)
				{
					if(ds.Tables[0].Rows[i][4].ToString().Trim()==
						this.data_list.Items[j].ToString())
					{
						goto END;

					}
				}
				this.data_list.Items.Add(ds.Tables[0].Rows[i][4].ToString().Trim());
			END:{};
			}
			this.data_list.SelectedIndex=0;
		}

		
     

	}
}

⌨️ 快捷键说明

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