Print Page | Close Window

Passing Parameters from ASP.NET Application to Cry

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=11868
Printed Date: 03 May 2025 at 8:27pm


Topic: Passing Parameters from ASP.NET Application to Cry
Posted By: cingo
Subject: Passing Parameters from ASP.NET Application to Cry
Date Posted: 14 Dec 2010 at 8:20pm
Passing Parameters from ASP.NET Application to Crystal Report Application

Hello,

if i do not bind to a dataset, i get the passed parameters from .cs, correctly in the report without it asking values.
BUT
if i bind report using dataset, then it shows a form to fill parameter values, even if i set the values in .cs
i dont want the form to be displayed..

please help...

code:
   
 CrystalReport1.Class1Crstal.insert_Selected_Doctor_labels_Reports_Temp(uid, session_id);
            OdbcDataAdapter adp = new OdbcDataAdapter();
            adp = Class1Crstal.get_CrystalReports_Doctor_labels_Reports(uid, session_id);
            DS = new DataSet();
            adp.Fill(DS, "Bill_Header_Report_Temp");
            rptDoc.Load(Server.MapPath("~/Reports/51_dr list.rpt"));
            rptDoc.FileName = Server.MapPath("~/Reports/51_dr list.rpt");
           

            CrystalReportViewer1.Visible = true;
         
            //CrystalReportViewer1.ReportSource = rptDoc;
            string categoryID = "SP1";
            rptDoc.SetParameterValue("CategoryID", categoryID);
            string Line1 = "SP2";
            rptDoc.SetParameterValue("Line1", categoryID);
            string Line2 = "SPE2";
            rptDoc.SetParameterValue("Line2", categoryID);
            string Line3 = "SPEC2";
            rptDoc.SetParameterValue("Line3", categoryID);

rptDoc.SetDataSource(DS);
            CrystalReportViewer1.ReportSource = rptDoc;



Regards
cingo
 



Replies:
Posted By: headache
Date Posted: 06 Jan 2011 at 8:12pm
From my Experience
It might happen because
1. there is error when fill the dataset (you can do debug on this, catch the error)
2. you have to check the database fields in report, refresh the data connections. sometimes there is changes that occur (possibly different columns by name or count). So you need to refresh the database fields to ge sync with the dataset.


Posted By: asam
Date Posted: 08 Jan 2011 at 8:53am
I do not use the process that you describe for getting the data and setting the report data source to that data - -
but in my humble experience I have found that I have to SetParameterValue AFTER I set the report data source.



Print Page | Close Window