Solved

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

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

758 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

23 Experts available now in Live!

Get 1:1 Help Now