Data Connectivity
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Data Connectivity
Message Icon Topic: Invalid Report Source - Help! Post Reply Post New Topic
Author Message
hdjim69
Newbie
Newbie


Joined: 29 Dec 2008
Location: United States
Online Status: Offline
Posts: 24
Quote hdjim69 Replybullet Topic: Invalid Report Source - Help!
    Posted: 08 Jan 2009 at 8:41am
Hello, I'm trying to assign a datatable to a CR in C# in VS2005 and I keep getting the error "Invalid Report Source".  I tried a few different ways.  Code below.
 
oRpt.Database.Tables[0].SetDataSource(oDT);
oRpt.SetDataSource(oDT);
 
I've validated the oDT (datatable) has rows.
 
Obviously, I'm doing something wrong.  How to assign a datatable with rows as the datasource to a CR?
 
TIA
hd
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 20 Jan 2009 at 1:36pm

The method that works for me is to set the DataSource of the report to the DataSource in my project.  This will work if the DataTable to be used by the report will always have the same name inside the DataSource.  The code looks something like this:

MyReport rpt = New MyReport();
rpt.SetDataSource(rptDataSource);
 
-Dell
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.