Setting the datasource for a Local Report - .NET & Report Viewer

前端 未结 3 1394
野趣味
野趣味 2020-11-29 06:42

I have created a custom control (a windows form with a report viewer). I have the following code to load a local report:

Contained in CustomReportViewer Clas

3条回答
  •  广开言路
    2020-11-29 07:27

    you may be able to just use a datatable instead of a dataset. change this:

    DataSet ds = new DataSet();
    da.Fill(ds);
    DataTable dt = ds.Tables[0];
    

    to this:

    DataTable dt = new DataTable();
    da.Fill(dt);
    

    and this:

    reportDataSource.Value = ds.Tables[0];
    

    to this

    reportDataSource.Value = dt;
    

提交回复
热议问题