Link to home
Start Free TrialLog in
Avatar of pckben
pckbenFlag for Singapore

asked on

How to bind only 1 DataRow Object to the Report?

Hi there,

I have a strongly typed dataset, now I want to display all the information of only 1 selected Row on the Crystal Report. Is there any way to 'bind' this object to the report? (not the passing parameters solution)

I've tried this ...

In VS2005, in the Report Designing page,
I added 1 Data Source of Type Object and chosed an DataRow object, then renamed it to "myDataSetName". Then I passed the Row need to be displayed using the following statement:

myReportViewer.LocalReport.DataSources.Add(new ReportDataSource("myDataSetName", myDataRowObject));

... but it gave me an ArgumentException:
Value does not fall within the expected range.

Anyone could help me please?
Thanks in advance,
pckben.
Avatar of pckben
pckben
Flag of Singapore image

ASKER

ok i found my own answer:
use a BindingSource object to bind to the specific DataRow, then
myReportViewer.LocalReport.DataSources.Add(new ReportDataSource("myDataSetName", myBindingSourceObject));
ASKER CERTIFIED SOLUTION
Avatar of GhostMod
GhostMod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial