There is a barely documented problem with Crystal Reports for .NET that occurs if you try to pass a dataview as a datasource to a report. The report has been built via a project dataset (XSD).
Here is the tech support entry. It has a tracking id of “CR ADAPT00117088”. I probably don't have the latest patch but there is no reference anywhere else to this track id.
The work around is just to pull the dataview data into a new datatable. Crystal doesn't give a sample so here is one for anyone who may be looking.
First here is the long way around if you need a table to move into a dataset.
Dim tbl As DataTable = myDataView.Table.CloneDim iRow As Int32For iRow = 0 To dv.Count - 1 tbl.ImportRow(dv.Item(iRow).Row)Nextmycrystalreport.SetDataSource(tbl) 'this assumes you only have one table for your datasource
(I need to make a confession - I have been so stung by the problem of trying to move a table from one dataset into another that I didn't stop and think that I was sending a datatable not a dataset, so I did this the long way around. Thanks to Mike below for pointing out my silliness...see his comment for the easy way.)
Remember Me
See my speaking schedule for more events
User Group Leader
Hosted by:
Powered by: newtelligence dasBlog 2.0.7226.0
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2008, Julie Lerman
E-mail