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

This is the first time I'm working with crystal reports. What i am trying to do is crating a single crystal report which populated at runtime using with select command therefore I write the code onload event of page My code is-
try
            {
                ReportDocument cryRpt = new ReportDocument();
              
                cryRpt.Load(@"C:\Users\Avi\Documents\Store backup\1Apr\store\Bill.rpt");

                con.Open();
                adp = new SqlDataAdapter("Select * from Store_Purchasebill where Bill_no=" + bill + "", con);
                DataSet ds = new DataSet();
                adp.Fill(ds, "Store_Purchasebill");

                if (ds.Tables[0].Rows.Count > 0)
                {
                    //.......Put the whole part of report bellow..............
                    cryRpt.Load(@"C:\Users\Avi\Documents\Store backup\1Apr\store\Bill.rpt");
                    <big>cryRpt.SetDataSource(ds);// here i get error </big>

                    crystalReportViewer1.ReportSource = cryRpt;
                    crystalReportViewer1.Refresh();

                }
                             
            }
            catch (Exception se)
            {
                MessageBox.Show(se.Message.ToString());
            }


The error it show is report has no tables. I added a blank Crystal report if i need to add another type of report then plz tell me how to add that.

Thx in advance.
Posted
Updated 13-May-13 5:17am
v2
Comments
Kschuler 14-May-13 11:01am    
What do you mean a "blank" crystal report? Have you designed the crystal report and told it where you want it to display data in the different sections....Report/Page Header, Detail, Report/Page Footer, etc.? If you haven't, you need to design it first. You can enter design mode for a crystal report by just double clicking it in Visual Studio. (If you have Visual Studio 2010 you would have to install crystal reports seperately. Earlier versions automatically installed crystal reports along with visual studio.)

1 solution

Here check this thread[^] which explains the thing clearly with screenshot.
 
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