Solved

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

Posted on 2008-10-12
4
454 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 100

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 100

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

752 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