超市管理系统/JHCX.cs

(开头部分) 6KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient ;
namespace 超市管理系统
{
    public partial class JHCX : Form
    {
        public JHCX()
        {
            InitializeComponent();
        }
        int n = 0;
        private void bind(string strcmd)
        {
            DataSet ds = new DataSet();
            ds=DBAccess.ExDs(strcmd);
            this.dataGridView1.DataSource = ds.Tables[0];
        }
        private void JHCX_Load(object sender, EventArgs e)
        {
            str1 = "select a.InID,a.商品ID,b.商品名称,b.商品类型,a.数量,a.单价,a.经办人,a.日期,a.备注 from InInfo a,MInfo b where a.商品ID=b.商品ID";
            bind("select a.InID,a.商品ID,b.商品名称,b.商品类型,a.数量,a.单价,a.经办人,a.日期,a.备注 from InInfo a,MInfo b where a.商品ID=b.商品ID order by a.inID desc");
            SqlConnection cn = DBAccess.ExCon();            
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = cn;
            cmd.CommandText = "select distinct 商品类型 from MInfo";
            cn.Open();
            SqlDataReader dr = cmd.ExecuteReader();
            while (dr.Read() == true)
            {                
                this.comboBox1.Items.Add(dr["商品类型"].ToString());
            }
            cn.Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {//重置按钮,清空文本框内容和组合框的选择项,并初始化dataGridView里的数据

            this.textName.Text = "";
            this.comboBox1.SelectedIndex = -1;
            bind("select a.InID,a.商品ID,b.商品名称,b.商品类型,a.数量,a.单价,a.经办人,a.日期,a.备注 from InInfo a,MInfo b where a.商品ID=b.商品ID order by a.inID desc");
        }
        string str1;
        private void button1_Click(object sender, EventArgs e)
        {//查询按钮
            str1 = "select a.InID,a.商品ID,b.商品名称,b.商品类型,a.数量,a.单价,a.经办人,a.日期,a.备注 from InInfo a,MInfo b  where a.商品ID=b.商品ID ";
            if (this.textName.Text.Trim() != "")
                str1 += string.Format(" and b.商品名称 like '%{0}%'",this.textName.Text.Trim());
            if (this.comboBox1.SelectedIndex >= 0)
                str1 += string.Format(" and b.商品类型='{0}'",this.comboBox1.Text);
           // str1 += string.Format(" and a.日期>='{0}' and a.日期<='{1}'",date1.Value.ToShortDateString(),date2.Value.ToShortDateString());
           // str1 += " order by a.inID desc";
            string datestr1,datestr2;
            datestr1 = date1.Value.Year + "-" + date1.Value.Month + "-" + date1.Value.Day;
后面还有 90 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。