Topic: Object Collection as Subreport DataSource Posted: 19 Apr 2010 at 4:27am
I'm using Object Collection as data source of main report as well as subreport. I can generate report of single Distributor with a collection of sales information using OBJECT COLLECTION Technology but facing problem when i want to create report with a number of Distributors with subreport containing sales info using object collection. i.e i need to setDataSource of the subreport, which shows sales info, for each Distributor in loop. pls take a look in the following code depicting where i need help : I don't want to use any ODBC connection for subreport DataSource.
Private Sub cmdDWSH_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDWSH.Click
Dim DWSHs As New ArrayList
Dim dwsh As clsDWSH
Dim RptDwsh As New DWSH (This is Crystal Report File)
Dim colDistrib As List(Of clsDistributor)
Dim DistribDA As New DistributorDataAccess
--(NOTE : I NEED TO SET THE SUBREPORT DATABASE IN THIS LOOP. I DON’T KNOW WHETHER IT IS POSSIBLE)--
Next i
RptDwsh.SetDataSource(DWSHs)
--(I WANTED TO PUT THE LINE OF CODE BELOW HERE BUT IT EXECUTES WITHOUT ANY OUTPUT)--
RptDwsh.Subreports(0).SetDataSource(Sales)
--(ABOVE LINE OF CODE WORKS FINE FOR SINGLE DISTRIBUTOR AND ALL SALES INFO OF THE DISTRIBUTOR BUT I NEED A NUMBER OF DISTRIBUTORS AND SALS INFO FOR EACH DISTRIBUTOR TO BE PRINTED)--
Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Posted: 21 Apr 2010 at 7:52am
Perhaps I am missing something, why not have the DADistributor load a dataset as opposed to a list and then use the dataset as your datasource? They (datasets) are something that CR is designed to handle.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum