report viewer blank fields RRS feed

  • Question

  • Hy, I have a WinForm application in VS2010 and I want to use report viewer. It works fine until I want to put some parameters in my report. After I put the parameters I see only the parameters values and nothing from the report, where I should have values, because I use the same dataset as initial.

    Could someone help me to find out where is the problem?


    Monday, March 7, 2011 8:20 AM

All replies

  • Can you post some code?


    Wednesday, March 9, 2011 12:16 AM
  • here is my code: <br/>
    reportViewer1.ProcessingMode = ProcessingMode.Local;
        reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Dataset1", Dataset1.Tables[0]));
        reportViewer1.LocalReport.ReportPath = @"Report1.rdlc";
        ReportParameter[] parameters = new ReportParameter[4];
        parameters[0] = new ReportParameter("datastart",dateTimePickerStartRaport.Text);
        parameters[1] = new ReportParameter("dataStop", dateTimePickerStopRaport.Text);
        parameters[2] = new ReportParameter("TotalI", TotalI.ToString());
        parameters[3] = new ReportParameter("TotalD", TotalD.ToString());

    Wednesday, March 9, 2011 12:10 PM
  • i think you can set the parameter when filling your dataset this is your first option,

    second you have to be sure that your condition is true and your condition must return result ,third you have to fill your dataset before set it as a reportdatasource




         Dataset1 currentData = new Dataset1();            

                    ReportDataSource dsTable = new ReportDataSource();                    

                    // note that "DataSet1_" is the name of your dataset
                    dsTable.Name = "DataSet1_" + currentData.Tables[0].TableName;

                   //use table adabter to fill your dataset

                        DataSet1.YourTableNameTableAdapter tmp = new DataSet1.YourTableNameTableAdapter();
                     // you can set your parameter here when you retreive the data you can pass your parameter to getData function in your dataset
                      //  useID = 2;                   
                      // dsTable.Value = tmp.GetData(useID);

                      dsTable.Value = tmp.GetData();

    then you append your code,i hope this work .


    Thursday, March 10, 2011 9:24 AM