Using IList<T> As DataSource for Crystal Reports

I am currently changing all my applications over from using DataSets to using IList<T> as created by Lightspeed ORM.

Whilst I know how to assign the IList<T> as the datasource at runtime.  I am unable to find a way to assign the class as a datasource at design time so I can set the report layout.  Has anyone done this?

I am using VS2008, Framework 3.5 with Crystal Reports 2008.
LVL 6
townsmaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kaylanreilorCommented:
I think this guy here (http://www.softpilar.com/knowledge-sharing/how-to-create-a-crystal-reports-invoice-and-export-it-as-pdf.aspx) is doing the same as you need. If you look to the "Fill data in the dataset and bind it to the report template" section you'll see that he has got a custom object list "IList<InvoiceLine>".
0
townsmaAuthor Commented:
Thanks for the link, but this is not really what I am looking for.  A Crystal Report can bind to data in any object as long as it is based on IEnumerable, i.e. IList<T>.  In the example shown, the guy creates a Dataset, then copies the information from the IList<T> into the DataSet to pass to the report.  When actually you can pass the IList<T> directly to the report.

However, the point of my question is not how to pass the data to the report a runtime, but rather how to design the report based on the class in the IList<T>.  I have read the article on the CR  (SAP) website entitled Crystal Reports in VS2005 walkthrough, and in particular, Binding to .Net Objects.  However, I run in to some problems, maybe because using VS2008.  Firstly, and most importantly, the class created by Lightspeed does not appear in the list of .Net Objects.  

Has anyone used Lightspeed object with Crystal Reports?
0
kaylanreilorCommented:
Did you already go through this tutorial : http://msdn.microsoft.com/en-us/library/ms227595.aspx.
They are not using an IList<> collection but an ArrayList and the SetDataSource method of the report (http://msdn.microsoft.com/en-us/library/ms227653.aspx). Nevertheless, I understand for now that you don't absolutely need to use IList<>, do you ? And anyways, I think that doint the same with an IList<> would work as well.
0
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

townsmaAuthor Commented:
Hi, the information there is almost identical to that on the SAP website.  However, I can't get it to work.  

The class is auto-created by Lightspeed, but is public with pubic properties etc. the same as the sample.  But when I use the Wizard in Crystal Reports, under .Net Objects, the Lightspeed classes are not available for me to select them.  I  think this is because the Lightspeed "Data" Classes are located in a separate data project, where the report file is in a UI project.

So I tried to create a new class inherited from the Lightspeed class, but when I do this, it asks me for the path to the XML file?  All very confusing.
0
gokujamesCommented:
Please copy the Class generated by Lightspeed to a separate Class file & add to App_Code folder of asp.net application.Now you can add a "Object DataSource" from the Data tab of the Toolbox & configure it in such a way that ,the method of the Lightspeed generated class can be used for various purposes.
0
townsmaAuthor Commented:
Thanks for the reply.  Firstly, our application is not a web app, it is Winforms based.  

Also, I tried to copy the LS generated class to a module in the same project the reports are being created in, but the Crystal Reports object data source was still unable to use it.

What I did as a work around, was to create a class in exactly the same way as described in the SAP website,  this I can then use in the report designer, then at runtime use LINQ to populate an IList<newclass>, and assign this as the data source for the report.  This works fine, although it seems a lot of work to get the data from a database to a report.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
surabhi_shresthaCommented:
Please anyone if you have used post the answer to this question...
I am currently changing all my applications over from using DataSets to using IList<T> as created by Lightspeed ORM.

Whilst I know how to assign the IList<T> as the datasource at runtime.  I am unable to find a way to assign the class as a datasource at design time so I can set the report layout.  Has anyone done this?

I am using VS2005, Framework 2.0 with ReportViewer
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.