Parameter Missing a value for the RDLC in Report Viewer for the C# Code - Urgent

  • Hi All,

    I have developed the Reports in SSRS..that means (.rdl files) and for this rdl files I am using the Stored Procedures to build the report and The database is in DB2 so I am calling the tables from DB2 through the linked Serevr and as my Stored Proc is linked with the tables in DB2 it really works fine in Business Intelligence Studio that means .rdl file works fine..

    1. after that with some information on Internet I am changing the name of the .rdl file to .rdlc.

    2. then adding the .rdlc file to my web application in ASP.Net and C#.net.

    3. Then in the aspx design Mode, I am dragging the Report Viewer Control from the Tool Box in Data. In the Report Viewer Control I am able to select the .rdlc file that added to my web application.

    4. Then I am trying to add the Data Source and everythign I added ...And My stored Proc also shown in the drop down..so I am selecting that. After that it automatically shows all my 3 parameters and it asks me for the Parameter source. Since I am using the Query for parameters, From the drop down I selected Querystring and then It asks for the Querystring Field and Default value. I have given the filedname from the Table DB2.. and for Default values, some values from the Table.

    5. Then after clicking Next Button I am able to test the Query by giving the Parameter values and everything is fine. When I click finish and then Run the Application.

    6. Then if I go to the aspx page which contains Report Viewer It is Showing as rpt_as_of_dt Parameter is missing a value..

    7. For every parameter it is showing as that the Parameter is missing a value.

    Not only for this report for every report, Almost I tried for 3-4 reports.

    I Just want to know..is there anywhere that I have to write the C# Code.. Beacuse I never touched the C# page for the Report . The Report that does not have parammeters and they really working Amazing only with the Parameters I am getting this problem. Is there any alternative way that I can call the Parameters..from code..IF so please give me all the details eloborately and also the sample code..

    And I did not used any source code till now....Do I require to use the code for calling the parameters ..I am newbie to both .Net and SSRS...Please help me..

    Really time is heading up and I have almost 30-40 reports to be done 90% of them are with paramters Please help me... I am stuck....

    Thanks.

    -- DEVAM 🙂

  • Please post your .NET code. Then we may be able to help. It seems like you are not correctly initializing the parameters in .NET.

  • Please see my C sharp code below to pass the parameter in the report. It takes in one

    parameter that is 'Lname'.

    The button click event is used to show the report below in the Report Viewer control.

    Csharp Code:

    using System;

    using System.Configuration;

    using System.Data;

    using System.Web;

    using System.Web.Security;

    using System.Web.UI;

    using System.Web.UI.HtmlControls;

    using System.Web.UI.WebControls;

    using System.Web.UI.WebControls.WebParts;

    using System.Data.SqlClient;

    using Microsoft.Reporting.WebForms;

    public partial class _Default : System.Web.UI.Page

    {

    protected void Page_Load(object sender, EventArgs e)

    {

    ReportViewer1.Visible = false;

    }

    protected void Button1_Click(object sender, EventArgs e)

    {

    string sReportServerURL = "http://LocalHost/ReportServer";

    string sReportPath = "/Report1";

    Microsoft.Reporting.WebForms.ReportParameter[] Param = null;

    Param[0] = new Microsoft.Reporting.WebForms.ReportParameter("Lname",this.TextBox1.Text);

    ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;

    ReportViewer1.ServerReport.ReportServerUrl = new Uri(sReportServerURL);

    ReportViewer1.ServerReport.ReportPath = sReportPath;

    ReportViewer1.ServerReport.SetParameters(Param);

    ReportViewer1.ShowParameterPrompts = false;

    ReportViewer1.ShowPromptAreaButton = false;

    ReportViewer1.LocalReport.Refresh();

    ReportViewer1.Visible = true;

    }

    }

    Thanks.

    -devam

  • Hey m back ... also when I run the code then it shows me the error ...

    "Object reference not set to an instance of an object."

    NullReferenceException

    Here is the code once again:

    using System;

    using System.Configuration;

    using System.Data;

    using System.Web;

    using System.Web.Security;

    using System.Web.UI;

    using System.Web.UI.HtmlControls;

    using System.Web.UI.WebControls;

    using System.Web.UI.WebControls.WebParts;

    using System.Data.SqlClient;

    using Microsoft.Reporting.WebForms;

    public partial class _Default : System.Web.UI.Page

    {

    protected void Page_Load(object sender, EventArgs e)

    {

    ReportViewer1.Visible = false;

    }

    protected void Button1_Click(object sender, EventArgs e)

    {

    string sReportServerURL = "http://LocalHost/ReportServer";

    string sReportPath = "/Report1";

    Microsoft.Reporting.WebForms.ReportParameter[] Param = null;

    Param[0] = new Microsoft.Reporting.WebForms.ReportParameter("Lname", this.TextBox1.Text);

    EReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;

    ReportViewer1.ServerReport.ReportServerUrl = new Uri(sReportServerURL);

    ReportViewer1.ServerReport.ReportPath = sReportPath;

    ReportViewer1.ServerReport.SetParameters(Param);

    ReportViewer1.ShowParameterPrompts = false;

    ReportViewer1.ShowPromptAreaButton = false;

    ReportViewer1.LocalReport.Refresh();

    ReportViewer1.Visible = true;

    //ReportViewer rv = new ReportViewer();

    //string sReportServerURL = "http://LocalHost/ReportServer";

    //string sReportPath = "/Report1";

    //Microsoft.Reporting.WebForms.ReportParameter[] Param = null;

    //Param[0] = new Microsoft.Reporting.WebForms.ReportParameter("Lname", this.TextBox1.Text);

    //rv.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;

    //rv.ServerReport.ReportServerUrl = new Uri(sReportServerURL);

    //rv.ServerReport.ReportPath = sReportPath;

    //rv.ServerReport.SetParameters(Param);

    //rv.ShowParameterPrompts = false;

    //rv.ShowPromptAreaButton = false;

    //rv.LocalReport.Refresh();

    //rv.Visible = true;

    }

    }

    Thanks.

    -DEVAM 🙂

  • Okay. Here are your problems.

      1. You are trying to work with a Server report, but using local report code. Change the processing mode to Remote, change ReportViewer1.LocalReport.Refresh to ReportViewer1.RefreshReport

      2. You need to change the Param = null; to Param = {new Microsoft.Reporting.WebForms.ReportParameter("Lname", this.TextBox1.Text)}; and get rid of the Param[0] = new Microsoft.Reporting.WebForms.ReportParameter("Lname", this.TextBox1.Text).

    I believe that those changes should fix it. If not post again.

  • Hey thanks for the changes ...

    The is going to work fine I think so ... but I have one error ...

    I am writing this code in Visual Studio and the OS is MS Server 2003 enterprise edition.

    I am using the port 90 so I changed the URL a little bit... but it is ok..

    Problem starts here :

    Please see the code below and the error occurs in the line which is here BOLD.

    protected void Button1_Click(object sender, EventArgs e)

    {

    ReportViewer ReportViewer1 = new ReportViewer();

    string sReportServerURL = "http://localhost:90/ReportServer";

    string sReportPath = "/Report Project1/Report1";

    Microsoft.Reporting.WebForms.ReportParameter[] Param =

    {new Microsoft.Reporting.WebForms.ReportParameter("Lname",this.TextBox1.Text)};

    ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote;

    ReportViewer1.ServerReport.ReportServerUrl = new Uri(sReportServerURL);

    ReportViewer1.ServerReport.ReportPath = sReportPath;

    ReportViewer1.ServerReport.SetParameters(Param);

    ReportViewer1.ShowParameterPrompts = false;

    ReportViewer1.ShowPromptAreaButton = false;

    ReportViewer1.ServerReport.Refresh();

    ReportViewer1.Visible = true;

    }

    The error message:

    ReportServer Exception was unhandled by the user code.

    " The permissions granted to user 'NT AUTHORITY\NETWORK SERVICE' are insufficient for performing this operation. (rsAccessDenied) "

    Please let me know the changes ... I might be having problems with IIS ... Active Direc Group/User ... 😉

    or whatever ..... a

    ANY HELP APPRECIATED ...

    THANKS.

    -- DEVAM

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply