Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2008-10-12
4
Medium Priority
?
458 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

CHALLENGE LAB: Troubleshooting Connectivity Issues

Goal: Fix the connectivity issue in the lab's AWS environment so that you can SSH into the provided EC2 instance.  

Question has a verified solution.

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

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…
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.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

660 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