Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stored Procedures, C# and Crystal Reports

Status
Not open for further replies.

hne

Programmer
Oct 16, 2003
38
US
Hello,
I really hope someone can help me with is one. I have program written in C# and MS SQL Stored Procedures already ported to my database. How can I pass these Stored Procedures parameters to Crystal Reports to view my output?

Thanks for your much needed heop!
 
Code:
CrystalDecisions.CrystalReports.Engine.ReportDocument cr = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

cr.Load(@"C:\ReportFileName.rpt"));

CrystalDecisions.Shared.ParameterValues pv = new CrystalDecisions.Shared.ParameterValues();

CrystalDecisions.Shared.ParameterDiscreteValue pdv = new CrystalDecisions.Shared.ParameterDiscreteValue();

pdv.Value = 100; //Or a string, or boolean etc

pv.Add(pdv);
					
cr.DataDefinition.ParameterFields["@Parameter_Name"].ApplyCurrentValues(pv);

crystalReportViewer1.ReportSource = cr;
 
First let me apologize that I did not respond initially to your response. Thank you very much for your help. However, when I use the example above, I get the error "Object reference not set to an instance of an object". Is there something I am doing wrong in Crystal Report or Visual Studios? Thanks in advance for your help and response.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top