Пример #1
0
        private void listView1_Click(object sender, EventArgs e)
        {
            string str_DID = this.listView1.SelectedItems[0].SubItems[0].Text;

            this.dataGridViewQG.AutoGenerateColumns   = false; // 关闭自动创建列
            this.dataGridViewPLCG.AutoGenerateColumns = false; // 关闭自动创建列
            string sql = "select * from HY_RequisitionInfo where r_DID='" + str_DID + "'";

            this.dataGridViewQG.DataSource   = hyrepinfobll.ExecuteQuery(sql);
            this.dataGridViewPLCG.DataSource = hyrepinfobll.ExecuteQuery(sql);


            string        sqlcont = "select count(*) as con from HY_RequisitionInfo where r_DID='" + str_DID + "'";
            SqlDataReader sdrcont = hyrepinfobll.f_RequisitionInfo(sqlcont);

            while (sdrcont.Read())
            {
                this.Statistics.Text = sdrcont[0].ToString();
            }
        }
Пример #2
0
        //自定义绑定数据
        private void requistionDate(string sql)
        {
            HY_BLL.HY_RequisitionInfoBLL hyul = new HY_RequisitionInfoBLL();
            this.listView1.View = View.Details;
            this.listView1.FullRowSelect = true;
            SqlDataReader sdr = hyul.f_RequisitionInfo(sql);
            while (sdr.Read())
            {
                ListViewItem lv = new ListViewItem(sdr[0].ToString());
                lv.SubItems.Add(sdr[2].ToString());
                if (sdr[1].ToString() == "已确认")
                {
                    lv.ImageIndex = 0;
                }
                else
                {
                    lv.ImageIndex = 1;
                }

                this.listView1.Items.Add(lv);
            }
        }