vinod patidar

vinod patidar

  • NA
  • 12
  • 7.9k

Typed DataSet with TableAdopter Not Bind properly with Reports in VS 2008

May 9 2011 1:16 PM
 

Dear friends,

I am currently working on window form application in vs. 2008 I am using Microsoft reporting service for generating reports.  I have typed dataset in my application in which there are 195 data table with table adopter and each table adopter have  a method to fill data table.

I am using single form(say  Viewer)  with single report viewer(say reportViewer1) to view all the reports, for this i have create public method for each report. The code from one of the method is as follows

 

public void LoadSomething(int SomePrimaryKey, string someremark)

        {

            SomeTableAdapter tb = new SomeTableAdapter();

           ReportDataSource rdc = new ReportDataSource(SomeDataSet.DataSetName,SomeDataSet.SomeDataTable);

          rdc.Name = "SomeDataSet_SomeDataTable";

         tb.Fill(SomeDataSet.SomeDataTable, SomePrimaryKey);

             reportViewer1.LocalReport.DataSources.Clear();

            reportViewer1.LocalReport.DataSources.Add(rdc);

this.reportViewer1.LocalReport.ReportEmbeddedResource = "SomeProject.Reports.SomeReport.rdlc";

          ReportParameter rpp = new ReportParameter();

            rpp.Name = "SomeRemark";

            rpp.Values.Add(someRemark);

            rpp.Visible = true;

            IList<ReportParameter> rpList = new List<ReportParameter>();

            rpList.Add(rpp);

            this.reportViewer1.LocalReport.SetParameters(rpList);

           reportViewer1.RefreshReport();

       }

 

In client code I am initializing the form viewer then calling the method LoadSomething and Finally call the ShowDailog()

The code compiled well but the problem arises when I load the client form and click the button to generate report first time. The viewer show up with blank report, however if i change the parameter (somePrimaryKey) the report worked fine and display all the fields.

I don't understand why its show up with blank report on first click but after changing the parameter it displays.

I check the Tables.Count property it exactly 195.

 

In all the 195 reports same problem arise.

 

and i have preview the data with parameters for checking errors in my sql and it preview as it expected.


Guys plz help 

Thanks in Advance

Vinod


Answers (5)