View Single Post
 
Old March 30th, 2007, 07:06 AM
snufse snufse is offline
Friend of Wrox
 
Join Date: Mar 2007
Location: West Palm Beach, Florida, USA.
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Default Binding a DataSet to Cystal Report

I have a sql select that calculates the sum of a "net" field and the max value of a "loads_today" field. The result is loaded into a DataSet (using vb code)


MyAdsSelect = "Select ticket_date, customer, customer_description_1, job,
job_phase, job_description_1, material, max(loads_today), sum(net) from
Salestkt where ticket_date =" & "'" & MyDate & "'" & "group by ticket_date,
customer, customer_description_1, job, job_phase, job_description_1,
material"


The DataSet, in addition to selected table fields, now have two additional columns, one for "max loads_today" and one for "sum of net value". The DataSet is bound to a DataGridView and diplayed. This works fine. Here is the code:

MyAdsAdapter.Fill(MyAdsDataset, "MyAdsDataTable")
DataGridView1.DataSource = MyAdsDataset.Tables("MyAdsDataTable")


I am also binding the same DataSet to a Crystal Report and it works fine except for the following: The report does not show the additional two calculated fields (it only shows the fields selected from the table that have been added to the Crystal report).

MyCrystalReport.SetDataSource(MyAdsDataset.Tables( "MyAdsDataTable"))
MyCrystalReportViewer.ReportSource = MyCrystalReport



Question: What do I need to do to show the max value of "loads_today" and the sum of the "net" field in Crystal Report since these tow field do not come from a table?

Thank you.