报告后面的代码查看器 [英] report Viewer in code behind

查看:57
本文介绍了报告后面的代码查看器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在以下代码中遇到问题:

  .reportViewer1.LocalReport .DataSources.Clear(); 
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter( select *来自输入,con);

da.Fill(dt);

Microsoft.Reporting.WinForms.ReportDataSource rprtDTSource = new Microsoft.Reporting.WinForms.ReportDataSource( input,dt);

this .reportViewer1 .LocalReport.DataSources.Add(rprtDTSource);
this .reportViewer1 .RefreshReport();

// 它在报表查看器中没有加载任何内容,当检查表dt时它有值,但无法显示,请帮助
// 我有仅设计视图上的报表查看器

解决方案

尝试:

 ReportDataSource rds =  new  ReportDataSource(  input ,dt); 

ReportViewer1.LocalReport.ReportPath = Server.MapPath( Report.rdlc);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(rds);
ReportViewer1.LocalReport.Refresh();





请按照以下文章:

在Web应用程序中使用Asp.Net本地报告(RDLC) [ ^ ]


感谢您的帮助,但

仍然无法显示报告查看器上的任何东西,并没有给出任何错误或异常,我正在使用Windows应用程序,这是我给你的mofified后的代码:



 Microsoft.Reporting.WinForms.ReportDataSource rds =  new  Microsoft.Reporting.WinForms.ReportDataSource(  input,dt); 
.reportViewer1.LocalReport.ReportPath = Report.rdlc;
reportViewer1.LocalReport.DataSources.Clear();
reportViewer1.LocalReport.DataSources.Add(rds);
reportViewer1.LocalReport.Refresh();
// Report.rdlc是包含表输入的所有列的报告


hi,, I have a problem in the following code:

            this.reportViewer1.LocalReport.DataSources.Clear();
            DataTable dt = new DataTable(); 
SqlDataAdapter da = new SqlDataAdapter("select * from input", con);
           
            da.Fill(dt);

            Microsoft.Reporting.WinForms.ReportDataSource rprtDTSource = new Microsoft.Reporting.WinForms.ReportDataSource("input", dt);

            this.reportViewer1 .LocalReport.DataSources.Add(rprtDTSource);
            this.reportViewer1 .RefreshReport(); 

//it loads nothing in the report viewer, and when check the table dt it has a value ,, but can't be displayed,, please help
// I have only Report viewer on the design view

解决方案

Try:

ReportDataSource rds = new ReportDataSource("input", dt);

ReportViewer1.LocalReport.ReportPath = Server.MapPath("Report.rdlc");
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(rds);
ReportViewer1.LocalReport.Refresh();



Please follow the below article:
Using Asp.Net Local Report (RDLC) in Web Applications[^]


thank you for your help but
still dosn''t display any thing on the report viewer and dosn''t give any error or exception,, am using windows app, and that was the code after I mofified it to yours.:

Microsoft.Reporting.WinForms.ReportDataSource rds = new  Microsoft.Reporting.WinForms.ReportDataSource("input", dt);
            this.reportViewer1.LocalReport.ReportPath = "Report.rdlc";
            reportViewer1.LocalReport.DataSources.Clear();
            reportViewer1.LocalReport.DataSources.Add(rds);
            reportViewer1.LocalReport.Refresh(); 
//Report.rdlc is report that has all column of table input


这篇关于报告后面的代码查看器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆