用sqlDataReader读取的数据,怎样显示在DataGridView里面?
在winform下 --------------------编程问答-------------------- 通过循环读取,每次循环DataGridView添加一行.--------------------编程问答-------------------- DataTable.Load (sqlDataReader);
DataGridView.DataSource=DataTable; --------------------编程问答--------------------
Cnn_SQL gjjl = new Cnn_SQL();
gjjl.Cnn_HS();
string gjjl_sql = "select b.kfname 库房名称,a.riqi 日期,a.djbh 单据编号,a.zhy 摘要,c.dwmch 进货单位,a.pihao 批号,a.rukshl 入库数量,a.rkdj 入库单价,a.rkje 入库金额 from spjxc a,huoweizl b,dwarc c where a.kfid=b.kfid and a.dwid=c.dwid and (a.zhy like '购进%' or a.zhy like '进货%') and a.riqi between '" + KaiShiriqi + "'" + " and '" + Endriqi + "'" + " and a.spid='" + textBox14.Text.Trim() + "'";
gjjl.Com_mand = new SqlCommand(gjjl_sql, gjjl.Cnn);
gjjl.DataAd = new SqlDataAdapter(gjjl_sql, gjjl.Cnn);
gjjl.DataSe = new DataSet();
gjjl.DataAd.Fill(gjjl.DataSe, "gjjl");
this.dataGridView4.DataSource = gjjl.DataSe.Tables[0];
补充:.NET技术 , C#