Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过asp.net代码填写rdlc报告_Asp.net_C# 4.0_Report_C# 3.0_Rdlc - Fatal编程技术网

通过asp.net代码填写rdlc报告

通过asp.net代码填写rdlc报告,asp.net,c#-4.0,report,c#-3.0,rdlc,Asp.net,C# 4.0,Report,C# 3.0,Rdlc,我试图用类型化数据集填充RDLC报告。我试图通过代码填充它,但不知道在特定的地方放什么 数据集的名称为GPSDBDataSet.XSD,如果是Report.rdlc,则报告的名称为Report,数据表的名称为Coordinates 使用Microsoft.Reporting.WebForms public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventA

我试图用类型化数据集填充RDLC报告。我试图通过代码填充它,但不知道在特定的地方放什么

数据集的名称为GPSDBDataSet.XSD,如果是Report.rdlc,则报告的名称为Report,数据表的名称为Coordinates

使用Microsoft.Reporting.WebForms

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ReportViewer1.Visible = true;

            ReportDataSource rds = new ReportDataSource();

            ReportViewer1.Reset();

            ReportViewer1.ProcessingMode = ProcessingMode.Local;

            LocalReport rep = ReportViewer1.LocalReport;                      

            rep.Refresh();

            rep.ReportPath = "Report.rdlc";


            rds.Name = ???????;


            rds.Value = ????;

            rep.DataSources.Add(rds);
    }
}

已经有一段时间了,但是试试这个

rds.name=“yourdatasetname”//在您的情况下,这将是协调的

rds.value=ds.table[0]

代码 数据集ds=新数据集()


查看此答案:没有帮助,请帮助Report Viewer配置错误Report Viewer Web控件HTTP处理程序尚未注册。您需要在Web.config中添加几行,然后就可以全部设置了。这是一个非常常见的问题,谷歌搜索错误文本会显示很多结果。
try
{
    ds = RetrieveData();//some func that returns dataset...
    ReportDataSource reportDataSource = new ReportDataSource();
    // Must match the DataSource in the RDLC
    reportDataSource.Name = "DataSet1";//coordinates in your case.
    reportDataSource.Value = ds.Tables[0];
    ReportViewer1.LocalReport.DataSources.Clear();
    ReportViewer1.LocalReport.DataSources.Add(reportDataSource);
    ReportViewer1.LocalReport.Refresh();

}
catch (Exception Ex)
{
    throw new Exception("Error Generating the Report", Ex);
}