Sreenath G

Sreenath G

  • NA
  • 233
  • 310.7k

Issue in retting Reportviewer Parameters in ASP.Net 2010

Aug 3 2011 12:44 AM
 

Hi,

I am trying to generate report during runtime using some parameters.But I am getting this error

"a data source instance has not been supplied for the data source dataset1"

 I have done the following.

1.       Created Dataset with query like SELECT   * FROM Sreenath where Sree=@Sree. This Sreenath  table has got Sree and ID as columns.

2.       Tagged it to Report1.rdlc.

3.       Attached Report1.rdlc to a reportviewer.

4.       While runtime  I trying to refresh the report in following ways...

First way:

                ReportParameter lObjParam = new ReportParameter("Sree", aStrSree);

                ReportParameter[] lArrParam = { lObjParam };

 

                ReportViewer3.LocalReport.SetParameters(lArrParam);

 

                ReportViewer3.LocalReport.Refresh();

 

Second Way

string lStrReportPath = ReportViewer3.LocalReport.ReportPath;

 

                DataSet2.SreenathDataTable lDS = new DataSet2.SreenathDataTable();

                DataSet2TableAdapters.SreenathTableAdapter lAdapter = new DataSet2TableAdapters.SreenathTableAdapter();

 

                lDS = lAdapter.GetDataIds(aStrSree);

 

                int lIntResult = lAdapter.Fill(lDS, aStrSree);

 

                ReportDataSource lDTSource = new ReportDataSource("DataSet2_Sreenath", (DataTable)lDS);

 

                ReportViewer3.LocalReport.DataSources.Clear();

 

                ReportViewer3.LocalReport.ReportPath = lStrReportPath;

 

                ReportViewer3.LocalReport.DataSources.Add(lDTSource);

 

                ReportViewer3.LocalReport.Refresh();

 

What is that I am doing wrong hereā€¦

 

Any help over here please.


Answers (1)