StoreQuery.cs
资源名称:yiyuan.rar [点击查看]
上传用户:yongjiajia
上传日期:2021-01-30
资源大小:686k
文件大小:9k
源码类别:
手机彩信(MMS)编程
开发平台:
ASP/ASPX
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- namespace 医院管理系统
- {
- /// <summary>
- /// StoreQuery 的摘要说明。
- /// </summary>
- public class StoreQuery : System.Windows.Forms.Form
- {
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.DataGrid dataGrid1;
- private System.Data.SqlClient.SqlDataAdapter da1;
- private System.Data.DataView dataView1;
- private 医院管理系统.DataSet3 dataSet31;
- private System.Windows.Forms.Label label4;
- private System.Windows.Forms.Button btnSearch;
- private System.Windows.Forms.TextBox txt1;
- private System.Windows.Forms.TextBox txt2;
- private System.Windows.Forms.Label label5;
- private System.Windows.Forms.TextBox txt3;
- private System.Windows.Forms.Label label1;
- private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
- private System.Data.SqlClient.SqlConnection sqlConnection1;
- /// <summary>
- /// 必需的设计器变量。
- /// </summary>
- private System.ComponentModel.Container components = null;
- public StoreQuery()
- {
- //
- // 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()
- {
- System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(StoreQuery));
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.label4 = new System.Windows.Forms.Label();
- this.btnSearch = new System.Windows.Forms.Button();
- this.txt1 = new System.Windows.Forms.TextBox();
- this.txt2 = new System.Windows.Forms.TextBox();
- this.label5 = new System.Windows.Forms.Label();
- this.txt3 = new System.Windows.Forms.TextBox();
- this.label1 = new System.Windows.Forms.Label();
- this.dataGrid1 = new System.Windows.Forms.DataGrid();
- this.dataView1 = new System.Data.DataView();
- this.dataSet31 = new 医院管理系统.DataSet3();
- this.da1 = new System.Data.SqlClient.SqlDataAdapter();
- this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
- this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
- this.groupBox1.SuspendLayout();
- ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataView1)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataSet31)).BeginInit();
- this.SuspendLayout();
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.label4);
- this.groupBox1.Controls.Add(this.btnSearch);
- this.groupBox1.Controls.Add(this.txt1);
- this.groupBox1.Controls.Add(this.txt2);
- this.groupBox1.Controls.Add(this.label5);
- this.groupBox1.Controls.Add(this.txt3);
- this.groupBox1.Controls.Add(this.label1);
- this.groupBox1.Location = new System.Drawing.Point(0, 0);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(520, 80);
- this.groupBox1.TabIndex = 0;
- this.groupBox1.TabStop = false;
- //
- // label4
- //
- this.label4.Location = new System.Drawing.Point(24, 24);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(32, 16);
- this.label4.TabIndex = 7;
- this.label4.Text = "库房";
- //
- // 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(384, 32);
- this.btnSearch.Name = "btnSearch";
- this.btnSearch.Size = new System.Drawing.Size(80, 24);
- this.btnSearch.TabIndex = 5;
- this.btnSearch.Text = "搜索";
- this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
- //
- // txt1
- //
- this.txt1.Location = new System.Drawing.Point(24, 40);
- this.txt1.Name = "txt1";
- this.txt1.Size = new System.Drawing.Size(88, 21);
- this.txt1.TabIndex = 3;
- this.txt1.Text = "";
- //
- // txt2
- //
- this.txt2.Location = new System.Drawing.Point(144, 40);
- this.txt2.Name = "txt2";
- this.txt2.Size = new System.Drawing.Size(88, 21);
- this.txt2.TabIndex = 4;
- this.txt2.Text = "";
- //
- // label5
- //
- this.label5.Location = new System.Drawing.Point(144, 24);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(64, 16);
- this.label5.TabIndex = 6;
- this.label5.Text = "药品编号";
- //
- // txt3
- //
- this.txt3.Location = new System.Drawing.Point(256, 40);
- this.txt3.Name = "txt3";
- this.txt3.Size = new System.Drawing.Size(96, 21);
- this.txt3.TabIndex = 4;
- this.txt3.Text = "";
- //
- // label1
- //
- this.label1.Location = new System.Drawing.Point(256, 24);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(64, 16);
- this.label1.TabIndex = 6;
- this.label1.Text = "药品名称";
- //
- // dataGrid1
- //
- this.dataGrid1.CaptionVisible = false;
- this.dataGrid1.DataMember = "";
- this.dataGrid1.DataSource = this.dataView1;
- this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
- this.dataGrid1.Location = new System.Drawing.Point(0, 80);
- this.dataGrid1.Name = "dataGrid1";
- this.dataGrid1.ReadOnly = true;
- this.dataGrid1.Size = new System.Drawing.Size(520, 408);
- this.dataGrid1.TabIndex = 1;
- //
- // dataView1
- //
- this.dataView1.Table = this.dataSet31.药品库存;
- //
- // dataSet31
- //
- this.dataSet31.DataSetName = "DataSet3";
- this.dataSet31.Locale = new System.Globalization.CultureInfo("zh-CN");
- //
- // da1
- //
- 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("备注", "备注")})});
- //
- // sqlSelectCommand1
- //
- this.sqlSelectCommand1.CommandText = "SELECT b.名称, a.编号, a.库房, a.药品编号, a.药品数量, a.备注 FROM 药品库存 a INNER JOIN 药品资料 b ON a." +
- "药品编号 = b.编号";
- this.sqlSelectCommand1.Connection = this.sqlConnection1;
- //
- // sqlConnection1
- //
- this.sqlConnection1.ConnectionString = "workstation id=localhost;packet size=4096;integrated security=SSPI;data source="." +
- "";persist security info=False;initial catalog=hisbook";
- //
- // StoreQuery
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
- this.ClientSize = new System.Drawing.Size(520, 485);
- this.Controls.Add(this.dataGrid1);
- this.Controls.Add(this.groupBox1);
- this.Name = "StoreQuery";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
- this.Text = "【药品库存量】";
- this.Load += new System.EventHandler(this.StoreQuery_Load);
- this.groupBox1.ResumeLayout(false);
- ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataView1)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.dataSet31)).EndInit();
- this.ResumeLayout(false);
- }
- #endregion
- //------------根据输入搜索药品库存信息-------------
- private void btnSearch_Click(object sender, System.EventArgs e)
- {
- string filter="";
- if(txt1.Text.Trim()!="")
- {
- filter+="库房 like '%"+txt1.Text.Trim()+"%' AND ";
- }
- if(txt2.Text.Trim()!="")
- {
- filter+="药品编号 like '%"+txt2.Text.Trim()+"%' AND ";
- }
- if(txt3.Text.Trim()!="")
- {
- filter+="名称 like '%"+txt3.Text.Trim()+"%' AND ";
- }
- int length=filter.Length;
- if(length>0)
- {
- filter=filter.Substring(0,length-5);
- }
- dataView1.RowFilter=filter;
- }
- //------------初始窗体时,填充数据集------------
- private void StoreQuery_Load(object sender, System.EventArgs e)
- {
- da1.Fill(dataSet31);
- }
- }
- }