Skip to Content
0
Former Member
Feb 23, 2009 at 06:57 PM

Report.SetParameterValue( , ) question

708 Views

I bought one more book and followed an example for .NET coding.

I do not want the parameter prompting screen to come up and I have a parameter value stored in a session variable that I am trying to use as the "value" in the following method from the book.

SetParameterValue(name as String, val as Object) that is used to set the parameter by name method.

But now when clicking to view the report, nothing comes up at all, not even an error message, no viewer frame or anything. Can anyone spot anything wrong here???

Should the name of the parameter be exactly like the name inside the actual report, of which I did. What haven't I set or missed?

thanks,

SMA

-


   private void Page_Init(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            string revid;
            revid = (string)Request.QueryString["ID"];
            Session["revid"] = revid;
            s_review_nbr = (string)Session["revid"];

            Int32 i_review_nbr = 0;
            bool isNum = false;
        isNum = Int32.TryParse((string)s_review_nbr, out i_review_nbr);
        if (isNum)
        {
            review_nbr = Convert.ToInt32(s_review_nbr);         
        } 
        ConfigureCrystalReports();
       }
    }  

private void ConfigureCrystalReports()
    {  
     .
     . Set my database connection stuff up hereu2026
     .
     .

    myReportDocument = new ReportDocument();
        string reportPath = Server.MapPath("Rev_Cat_Question_Completion2.rpt");
      myReportDocument.Load(reportPath);

                     myReportDocument.SetParameterValue("MyReviewNbr", review_nbr);
                      SetDBLogonForReport(connectionInfo, myReportDocument);  

    myCrystalReportViewer1.ReportSource = myReportDocument;
        
    }
private void SetDBLogonForReport(ConnectionInfo connectionInfo, ReportDocument myReportDocument)
    {
        Tables tables = myReportDocument.Database.Tables;
        foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
        {
            TableLogOnInfo tableLogonInfo = table.LogOnInfo;
            tableLogonInfo.ConnectionInfo = connectionInfo;
            table.ApplyLogOnInfo(tableLogonInfo);

        }
    } 

-


This is what is in the client/design part of the page

<div style="background-color: #999966">

<CR:CrystalReportViewer ID="myCrystalReportViewer1" runat="server"

AutoDataBind="true" EnableDatabaseLogonPrompt="False" HasDrillUpButton="False"

Height="50px" Style="position: relative" ToolbarStyle-BorderColor="#660033"

Width="350px" EnableParameterPrompt="False" EnableDrillDown="False" /> </div>