Click here to Skip to main content
15,912,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
double monthly = Convert.ToDouble(ds1.Tables[0].Rows[0]["Monthly"].ToString());
            double Qtr = Convert.ToDouble(ds1.Tables[0].Rows[0]["Qtr"].ToString());
            double halfYearly = Convert.ToDouble(ds1.Tables[0].Rows[0]["halfYearly"].ToString());
        double totamt = Convert.ToDouble(ds2.Tables[0].Rows[0]["AmountReceived"].ToString());
          
CrystalReport2 report = new CrystalReport2();
            report.SetDataSource(ds1.Tables[0].Rows[0]["halfYearly"].ToString());
            report.SetDataSource(ds2);
            report.SetDataSource(ds1.Tables[0].Rows[0]["Monthly"].ToString());
         
            crystalReportViewer1.ReportSource = report;


i want crystal report in following format
Monthly :(monthlyamt value)
half yearly:(half yearly value)
Total:(totamt)


i have taken dataset in design view ,added datatable and curresponding coulmn
to datatable and write above code for displaying report but is show blank data whats wrong here somebody help me?
Posted
Updated 16-Aug-12 11:14am
v2
Comments
veenusethi 20-Aug-12 1:03am    
i am also suffering from this problem

1 solution

Your process doesn't seem write. Let me give you another process step by step:

1. As you have added the dataset in design view, first design the Crystal report using your dataset.
2. Create the object of Crystal report as you have created.
C#
CrystalReport2 report = new CrystalReport2();

3. Set the data source property of Crystal Report Object.
C#
report.SetDataSource(ds1.Tables[0]);

4. Pass the report object to CrystalReportViewer.
crystalReportViewer1.ReportSource = report;



This should do the trick. For more information you can refer to following link.
Crystal Report with DataSet and DataTable using C#[^]
 
Share this 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