[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Problem with Crystal Report in c# (Windows Form).....

Posted on 2004-10-04
5
Medium Priority
?
264 Views
Last Modified: 2008-03-17
Hi Experts,
   
         I am trying to use Crystal Report in windows form in C#.
If I design everything at design time and then run the program then it is coming fine. But my requirment is to get the data at run time. In this case it is not giving any error, but not showing the report also. Repost viewer is blank.

Following is the snippet which, I am using.
              Here EstimatedHikeDetails  is report class.

               EstimatedHikeDetails rptEstimate = new EstimatedHikeDetails();
      SqlDataAdapter sqlAdapt = new SqlDataAdapter(" select * from estimatedresourcedetails ",sqlConn);
      DataSet dsNew = new DataSet();
      sqlAdapt.Fill(dsNew, "BU");
      sqlConn.Close();
      rptEstimate.SetDataSource(dsNew);
                  
      crystalReportViewer2.ReportSource = rptEstimate;
      crystalReportViewer2.Refresh();


Is this the correct way or wrong. And if this is wrong then can you please help me out...

Thanks
Bharat
0
Comment
Question by:bharat_mane
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 10

Accepted Solution

by:
123654789987 earned 100 total points
ID: 12224335
Can u verify if the Report file EstimatedHikeDetails  is populated correctly?

You can also check one more option of Getting the Report file into ReportDocument and then set the ReportSource of the Viewer to this ReportDocument.

The link below gives the different methods of setting a ReportSource

http://www.c-sharpcorner.com/Code/2003/Oct/CrystalReportsViewer.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/crystlmn/html/crsamreportbindingoptionsforwindowsformsviewers.asp
0
 
LVL 3

Assisted Solution

by:skpatra
skpatra earned 100 total points
ID: 12225926
You can use the Report Document Model (though I dont know why your code does not work). Do the followings:
1. Add reference to CrystalDecisions.CrystalReports.Engine.
1. Use ReportDocument object to load your rpt file.
        ReportDocument oDoc = new ReportDocument();
        oDoc.Load("C:\\MyFolder\\MyReport.rpt");
2. Attach the dataset
        SqlDataAdapter sqlAdapt = new SqlDataAdapter(" select * from estimatedresourcedetails ",sqlConn);
     DataSet dsNew = new DataSet();
     sqlAdapt.Fill(dsNew, "BU");
     sqlConn.Close();
     oDoc.SetDataSource(dsNew);
3. Assign the report document to the viewer
     crystalReportViewer2.ReportSource = oDoc;
     crystalReportViewer2.Refresh();
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question