Print Page | Close Window

The report has no tables. ? [RESOLVED]

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Report Design
Forum Discription: The best way to design a report and problems you have encountered
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=2839
Printed Date: 28 Mar 2024 at 5:47am


Topic: The report has no tables. ? [RESOLVED]
Posted By: elfstoneUK
Subject: The report has no tables. ? [RESOLVED]
Date 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



Replies:
Posted By: BrianBischof
Date 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>


Posted By: elfstoneUK
Date 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
 
 


Posted By: elfstoneUK
Date 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.


Posted By: skpraju
Date 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();



Posted By: Mitja Bonca
Date 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.


Posted By: lockwelle
Date 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?



Print Page | Close Window