In Crystal Reports for VS’s designer I couldn’t successfully
use “.Net Object” under “Project Data” for any new reports. I found I had to create a DataSet object manually
that mimics my classes public properties and then load that using “ADO.NET DataSets”
option. Then through code I was able to
use my classes GetData method to populate the report at run-rime like normal. In the past I was able to use “.Net Object” to
get the classes public properties to use at design time.
I didn’t like creating a DataSet to mimic my code for two
reasons. One if I had to change my class
I had to also update DataSet to refresh the definition in my report. Two it just felt like I was coding twice. Because of this I dug deeper. I then created a method in my class to return
my List as a DataSet. This was easy
enough after finding a generic List to DataSet conversion class to use. Then through using “Create New Connection”s “ADO.NET
(XML)”, I was able to use “Make New Connection” to link to my compiled assembly
(the dll in bin), choose the class and set the “Use DataSet from Class” option
and choose my method which returns a DataSet.
Everything was fine with this solution except, when I went to compile my
project. The dll was locked and compilation
failed when trying to copy the dll. It
seems the designer didn’t release the dll when it read the DataSet. I found if I closed VS and restarted,
everything was working fine.
So I have one question, is “.Net Object” not supported anymore? I have a few reports that were created using
this from years ago, and they run fine and I can change them in the designer. But when I tried to “Verify Database”, it threw up a message stating the table couldn’t be found and asked if I
wanted to remove it. When I said yes it removed
the table and all the fields, which in affect erased the report.