Solved

In C#, how do I load custom values into Crystal Reports?

Posted on 2008-10-12
4
455 Views
Last Modified: 2013-12-17
Greetings,

I am very new to C# and Crystal Reports.  I would like to display data in a Crystal Reports report that is the result of a SQL query. Additionally, I may have to massage some data before it is displayed (i.e. one field is an operation number, I want to add "Operation" to it.  Also add a line to the end of each row were initials will be added by hand later).

I am using the ReportPreview and the version of CR included with Visual Studio.

I understand how to add a static value:
TextObject preOrderNumb = TravelerReport.ReportDefinition.ReportObjects["txtOrderNumb"] as TextObject;
preOrderNumb.Text = "MyText";

But I'm not sure how do add the objects dynamically and assign my sql query values.  I have also investigated creating a custom dataset but have not had much success.

Thank you, in advance.
EP
0
Comment
Question by:Bullfighter
[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
  • 2
  • 2
4 Comments
 
LVL 101

Expert Comment

by:mlmcc
ID: 22703814
If you are doing this in the application simply assign values from the query as

preOrderNumb.Text = SomeQueryField

mlmcc
0
 
LVL 2

Author Comment

by:Bullfighter
ID: 22703994
Except how do I create more labels?  My sql query is returning a unknown amount of results. Each result represents an Operation. The query returns the Operation number, Setup Hours, Run Hours and End Time (These are the headers).

So in essence I have a set of data from my SQL query and I need to display each set of results under each heading.
Operation    Run Hours    Setup Hours   End Time    Initials
Op 1               5                     9                   Jan 5       _____
Op 2               2                     3                   Jan 8       _____

I have googled this to death - I see that I can link a report to a dataset based on tables - but I have to massage the data first. Not to mention the fact that I am using some dynamically created tables as well as some complex sql statements.

Is there a way to loop through my sql results and feed them into the crystal report modifying data as neded (adding the underscores/Lines, formatting datetime etc).
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 22704155
I don't think you can in the version included with VS.Net.

mlmcc
0
 
LVL 2

Accepted Solution

by:
Bullfighter earned 0 total points
ID: 22704544
Ok, thanks - I think i figured out a solution. I'm going to create a separate table, load my results and modified data into it and connect that table to the report. And if that doesn't work, I'll get the full version.

EP
0

Featured Post

Congratulations! You’re Certified – Now What?

Starting a new career can be overwhelming. Becoming certified in your field of expertise is a great start, but where do you go from here?  Here are some tips to help you on your career journey.

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

623 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