Report Design
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Report Design
Message Icon Topic: The report has no tables. ? [RESOLVED] Post Reply Post New Topic
Author Message
elfstoneUK
Newbie
Newbie


Joined: 07 Apr 2008
Location: United Kingdom
Online Status: Offline
Posts: 5
Quote elfstoneUK Replybullet Topic: The report has no tables. ? [RESOLVED]
    Posted: 07 Apr 2008 at 9:29am
Ladies and Gentlemen
Yout help please.
I've tried a search on this topic but to no avail  Confused, so I though I'd post it.
 
I'm new to Crystal Reports. I'm using VB 2005 and Crystal Reports XI.
I've been given the task to create a Winform to allow the user to create Ad Hoc reports from our table(s) in our Oracle DB. As I found out today, I need to utilize Runtime customization. I have a copy of Brian's book (CR & .NET programming) which I purchased over the weekend.
I'm working on ch 15, 16... at the moment and I'm stuck! I have used some code snippets from the book and I get this error: The report has no tables. I know the data is there because I can see it inth VB debugger but it will not work! Angry My code:

Dim da As OracleClient.OracleDataAdapter

Dim ds As New DataSet

Dim sql As String = "SELECT * FROM EUSER"

Dim tName As String = "EUSER"

Using cnn As OracleClient.OracleConnection = New OracleClient.OracleConnection(AdHocReportConnection)

cnn.Open()

da = New OracleClient.OracleDataAdapter(Sql, cnn)

da.Fill(ds) ', tName)

End Using

CreateXmlFile("USERTest", ds)

Dim myReport As New CrystalReport1

myReport.SetDataSource(ds)  'Error here...

CrystalReportViewer1.ReportSource = myReport

The code works fine up until the red line. What am I doing wrong???  Confused
 
Any help would be fantastic!
 
Thanks  Smile


Edited by elfstoneUK - 09 Apr 2008 at 6:54am
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 07 Apr 2008 at 3:21pm
I see that you call the CreateXMLFile() method, but are you using this file as the data source for your report? This is very important.

Also, you can try changing the 2nd to last line to this:
myReport.SetDataSource(ds.Tables(0))



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>
IP IP Logged
elfstoneUK
Newbie
Newbie


Joined: 07 Apr 2008
Location: United Kingdom
Online Status: Offline
Posts: 5
Quote elfstoneUK Replybullet Posted: 08 Apr 2008 at 1:01am
Brian, thanks for the reply.
 
I have tried what you suggested but with no luck. I did have the 2nd to last line as myReport.SetDataSource(ds.Tables(0)) but changed it to 'ds'.
 
So, now I have changed it back.
However, I'm still not sure if understand the principle here. If I need to make myReport the data source for the report then all I need to do is this.
Here is my revised code, only the last four lines have changed:
 

Dim myReport As New CrystalReport1

CreateXmlFile(myReport.ToString, ds)

myReport.SetDataSource(ds.Tables(0))    'Error here

CrystalReportViewer1.ReportSource = myReport   'Report as data source

I'm stuck here. I still get the error. CrystalReport1 has been added to the Solution Explorer and used here. Is this what I'm doing wrong?

The data is there because I can see it in the debugger. Could you explain what I should do here please? The error occurs before I get the chance to set the report source!

 

Any more help would be appreciated.

 
Smile
 
 
IP IP Logged
elfstoneUK
Newbie
Newbie


Joined: 07 Apr 2008
Location: United Kingdom
Online Status: Offline
Posts: 5
Quote elfstoneUK Replybullet Posted: 09 Apr 2008 at 3:52am
Can anybody help with my problem? Confused
 
I had to sort this myself but not the way I intended. So, I have made another post.


Edited by elfstoneUK - 09 Apr 2008 at 6:55am
IP IP Logged
skpraju
Newbie
Newbie


Joined: 13 Apr 2010
Location: India
Online Status: Offline
Posts: 1
Quote skpraju Replybullet Posted: 13 Apr 2010 at 8:40pm
hi,Did you got any solution in this problem .i have very urgent requirement.if u know the solution please mail(skpraju.bh@gmail.com) to me.I get this error: The report has no tables.


string str = "select * from tempa";
        SqlConnection cn = new SqlConnection("server= PENNANTSRV01;database=Practice;user id=sa;password=zxcvbn1@");
        SqlDataAdapter da = new SqlDataAdapter(str, cn);
        cn.Open();
        DataSet dt = new DataSet();
        da.Fill(dt, "dfg");
        if (dt.Tables[0].Rows.Count > 0)
        {
            CrystalDecisions.CrystalReports.Engine.ReportDocument crystalReport2;
            crystalReport2 = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
            crystalReport2.Load(Server.MapPath("CrystalReport.rpt"));

            //crystalReport2.Database.Tables[0].SetDataSource(dt.Tables[0]);
            
            crystalReport2.SetDataSource(dt.Tables[0]);// Error occured Here
            CrystalReportViewer1.ReportSource = crystalReport2;
            CrystalReportViewer1.DataBind();
        }
        cn.Close();

IP IP Logged
Mitja Bonca
Newbie
Newbie


Joined: 15 Feb 2012
Online Status: Offline
Posts: 1
Quote Mitja Bonca Replybullet Posted: 15 Feb 2012 at 4:32am
HOW CAN THIS POST BE RESOVLED???

Its far from being that.

I am the one who has this issue as well, and I cannot find the solution.
So what to do???

Please help.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 20 Feb 2012 at 3:35am
hmm...
Interesting....
I use xml files to populate my reports using this method (though not from Oracle) and have never encountered this.  When the report is designed is the datasource set to ADO.Net? 
 
Also to get the 'correct' schema, not just varchar(255) for every field, I need to create an xml file with the schema (and data makes the layout easier).  I write that out to a file, then use it as my datasource during the design phase of the report. Once the report previews/performs as I desire from the file, I just set the datasource to my dataset in code and the report displays.
 
Did you do something different?
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.047 seconds.