Print Page | Close Window

How to use DataReader in Crystal Report

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=2676
Printed Date: 03 May 2025 at 2:21pm


Topic: How to use DataReader in Crystal Report
Posted By: gaurish
Subject: How to use DataReader in Crystal Report
Date Posted: 21 Mar 2008 at 8:23am
Hi,
I use datareader to retrive data from database , I tried a lot to generate crystal report useing datareader but i failed ..
Can any one help me or can show me how to use datareader in crystal report ..
I would be really happy , if any one can help me .. Please .. Its urgent ..
Regards
I am using access database (.mdb) and VB.net
Gaurish Ray
 
 



Replies:
Posted By: BrianBischof
Date Posted: 21 Mar 2008 at 2:35pm
Are you using VB.NET 2005? I ask b/c you can't do this with VB.NET 2003.

It's a bit complicated, and I explain it in more detail and give sample code in my online  http://members.crystalreportsbook.com - Crystal Reports eBooks (you should check them out for a lot more info on using .NET with CR).

The way it works is that CR needs to know how the datareader's data is structured. The only way it can do this is by calling the datareader and examining it's data. So you have to put the datareader in its own DLL and return it using a Shared method (static in C#) of the IDataReader interface. Then when you design a new report, you can point the data source to this DLL and CR will instantiate the DLL, call the Shared method and determine the data structure to report from. When you run the report, it also uses this DLL to get the data to display on the report.

Once you get the report designed, in your project you need to instantiate the DLL in your code and send assign the datareader shared method to the SetDataSource method of the ReportDocument object.

I hope this helps.

You can find out more about my books at http://www.amazon.com/exec/obidos/ASIN/0974953601/bischofsystem-20 - Amazon.com or reading the http://members.crystalreportsbook.com - Crystal Reports eBooks online.


-------------
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: gaurish
Date Posted: 22 Mar 2008 at 6:29am
Many thanks for your reply.. Now I am looking at the web site u told to look at. Is there any chance to provide some code example .. I would be really greatful , If u kind enopugn to provide me code example..
 
many thanks again ..
regards
Gaurish
 



Print Page | Close Window