Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Friends ,

I am working with windows application with C#.As i am new to crystal reports am having a doubt.
I am displaying the report from dataset by passing two parameters.
After passing these two parameters i am binding the data into a dataset. The code is given below
C#
Dataset ds1=new Dataset();
rptwithItemDetails cr = new .rptwithItemDetails();
cr.SetDataSource(ds1.Tables[0]);
crystalReportViewer1.ReportSource = cr;
crystalReportViewer1.Refresh();

So when the report loads it will load from the dataset.
My requirement is that i have to set some report heading in every report(4 fields).
So i am fetching that details from my database table and loaded into another dataset say 'ds2'.

How to pass that values in the dataset as parameters for setting report heading.

Or can i choose any other option? (Note that the report heading have four fields which is fetching from database table)
Please help me .
Thanks a lot in advance.
Posted
Updated 5-Jul-10 20:02pm
v2
Comments
Sandeep Mewara 6-Jul-10 2:03am    
Use PRE tags for code formatting. Rectified typos.

1 solution

You can use Parameter in report

Or


Add a Text box in the header of the report.
Change the "Name" of the Text box to say "txtHead"

Now in your application write those code

Dim objText As CrystalDecisions.CrystalReports.Engine.TextObject
objText = rptReport.Section4.ReportObjects("txtHead")
objText.Text = ds2.tables(0).rows(0)("HEADER")


Note this code is in VB.Net. Please convert it in C# in your way
 
Share this answer
 
Comments
user0055224444 6-Jul-10 1:46am    
Please give code in C#
Sandeep Mewara 6-Jul-10 2:01am    
Well, if the answer satisfies you (other than language), use any VB to C# and convert it. Expecting exact code is not good, a direction has been given to you, try out now.
There are lots of free VB to C# converters on internet. Just Google it!
user0055224444 6-Jul-10 5:17am    
Thanks Sandeep Mewara . I got the answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900