Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing From Crystal Reports, No DB, C#

Status
Not open for further replies.

shadowlesshand

Programmer
May 29, 2002
21
HK
Hi All,
Is there a way to print a report from CR. I dont have a database table. Just datatable / string 2D array with the Information that needs to be printed. Column headers are included. I am using C# Win Forms code to achieve this.
Thanks
Karthik
 
If you toss your data into an ADO dataset in your project instead of an array, then Crystal can read from the dataset to get your data.

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Thanks for your reply. I believe in this case we already know the structure (ie. static columns). But my scenario is there are several grids which request for a report to be generated. The coulmns on these grids can vary. The user is able to send the data in this grid and the column headers to the report method. How do I build a report for such a dynamic data. Please cite an example when possible.
Thanks
 
Is there a maximum number of columns that the user can choose? Will this max number actually fit on a report?

The one way I can think of to do this sort of thing is to have two ADO tables - one for the column headers and the other for the data. These tables will have "generic" field names and the data table will have as many fields as the max number of columns that will be displayed on the report. Something like the following:
Code:
[u]Header_Table[/u]
RPT        Number(1)      Used to link the tables
RPT_HDR    String         Title to use in the Header
COL1_HDR   String         Header for Column1
COL2_HDR   String         Header for Column2
...
COL[i]n[/i]_HDR   String         Header for Column[i]n[/i]

[u]Data_Table[/u]
RPT        Number(1)      Used to link the tables.
COL1_DATA  String         Data for Column1
COL2_DATA  String         Data for Column2
...
COL[i]n[/i]_DATA  String         Data for Column[i]n[/i]

When the user wants to print the data, clear any existing data out of these tables and add the new data. In the RPT field, put some constant value like 1 so that the tables will link together and Crystal won't give you warnings. DO NOT put anything in the header or data records for those columns that are not in use.

You can then have one generic report that will connect to these two tables and display all of the data that's in the corresponding grids.

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top