c#+dev+sql展示行轉列報表

  


private void btnQuery_Click(object sender, EventArgs e)

        {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                if ((bool)dataGridView1.Rows[i].Cells["IsCheck"].EditedFormattedValue == true)
                {
                    string td = dataGridView1.Rows[i].Cells["提單編號"].Value.ToString();
                    sb.Append(td + ",");
                }
                else { }                
            }

            if (sb.Length >= 1)
            {
                sb.Remove(sb.Length - 1, 1);
                string tdbhstr = sb.ToString();
                txtTdbhstr.Text = tdbhstr;
                string wllb = cbxCplb.EditValue.ToString();
                string qsrq = dateEdit1.Text.Trim();
                string jsrq = dateEdit2.Text.Trim();                

                dataGridView1.Visible = false;
                gridControl1.Visible = true;
                gridControl1.DataSource = ProcSqlHelper.ExecuteDatatable("exec usp_tdNoFy @wllb,@qsrq,@jsrq,@str", CommandType.Text, new SqlParameter[] { new SqlParameter("@wllb", wllb), new SqlParameter("@qsrq", qsrq), new SqlParameter("@jsrq", jsrq), new SqlParameter("@str", tdbhstr) });
            }           
        }
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章