当前位置:编程学习 > C#/ASP.NET >>

reportViewer1数据绑定问题(winforms)

  DataSet myds = new DataSet();
            DataTable dt = myds.Tables.Add("newTables");
            dt.Columns.Add("Id", typeof(string));
            dt.Columns.Add("SudentName", typeof(string));
            dt.Columns.Add("SudentSex", typeof(string));
            dt.Columns.Add("BirthDate", typeof(string));
            dt.Columns.Add("AdmissionDate", typeof(string));
            DataRow addnewRow = myds.Tables["newTables"].NewRow();//初始化一行   
            List<Wzh_SudentData> model = Wzh_SudentDataBLL.GetListByWhere(0, "1=1");
            if (model != null)
            {
                foreach (Wzh_SudentData modela in model)
                {
                    addnewRow = myds.Tables["newTables"].NewRow();//初始化一行   
                    addnewRow["Id"] = modela.Id;//  
                    addnewRow["SudentName"] = modela.SudentName;
                    addnewRow["SudentSex"] = modela.SudentSex;
                    addnewRow["BirthDate"] = modela.BirthDate;
                    addnewRow["AdmissionDate"] =modela.AdmissionDate;//   
                }
            }
            ReportDataSource rds = new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", myds.Tables[0]);
            reportViewer1.LocalReport.DataSources.Clear();
            this.reportViewer1.LocalReport.DataSources.Add(rds);
            //reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource(rds));
            //reportViewer1.LocalReport.Refresh();
            this.reportViewer1.RefreshReport();

有查询到数据,就是显示不出来,大家看是那个错,帮我一下,谢谢了。 --------------------编程问答-------------------- --------------------编程问答-------------------- http://topic.csdn.net/u/20110103/12/e6fa7f01-b534-403d-9638-5e43b9997238.html
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,