Solved

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

Posted on 2008-10-12
4
451 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
  • 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

896 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now