Print Page | Close Window

Custom Class as DataSource

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Data Connectivity
Forum Discription: How to connect to data sources and export reports
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=672
Printed Date: 18 May 2024 at 12:48pm


Topic: Custom Class as DataSource
Posted By: wortho
Subject: Custom Class as DataSource
Date Posted: 16 May 2007 at 3:21am
I am sure this is terribly simple, which is probably why its so frustrating that I cant solve it.
 
What I have is a class library that provides my data, so instead of binding to a database, I can select .Net Data Provider (.dll) and bind to that class.
 
So I have basic properties like Firstname, Lastname exposed of the travellers object. Cool. I can drop these on the Crystal Report (using CR10 for VS2005).
 
Now some magic happens on the inside that populates these so I dont need to care about the actual database connection (for instance I have hard coded values in a proxy object at the moment for proof of concept).
 
However, when I run this ASP.NET application I get a page telling me to log in!
The message is;
"The report you requested requires further information."
And then there is a logon box for the database name, username and password and checkbox for integrated security.
I have tried setting the report to use different ConnectionInfoType (ie; MetaData) but am all out of ideas.
 
Any clues out there really appreciated.
 
Cheers,
Steve



Replies:
Posted By: wortho
Date Posted: 16 May 2007 at 3:20pm
Found the answer!
 
My custom class needed to implement IEnumerable interface!
 
So quite simply I just made a generic list of my class.
 
For instance;
 
List<Traveler> _travelerList = new List<Traveler>();
_travelerList.Add(...
 
Then report.SetDataSource(_travelerList)
 
So the database connection error kind of threw me off the scent that the underlying type was wrong.
 


Posted By: BrianBischof
Date Posted: 16 May 2007 at 6:42pm
Thanks for the update. I'm about a month away for digging into Crystal Reports .NET 2005 to update my 2003 book. It's good to know that it's as easy as they advertise it to be. 

-------------
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>


Posted By: billev
Date Posted: 20 May 2007 at 8:04am
Brian,
Tell me about your update to CR 2005.  Will it be a new book or an update to your existing 2003 book.  I have only used the versions of Crystal Reports that come with Visual Studio 2003 and 2005.  I would be using another reporting source if it weren't for your book.  I am anxious to see your "update" to VS 2005.
 
Thanks,
 
Bill V.


-------------
Thanks,

Bill V



Print Page | Close Window