cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid Table Number

Former Member
0 Kudos

I have a bunch of reports that were being created in CR 2008 - Well, most of them came from really old CR versions - I'm validating these reports with the CR .Net, but I have one report that I do not really know what it is happening there. If I open the report in designer everything is ok. But if I just open the report using the next code, I receive an exception. I've open the report in designer and I've removed all the components there and the behavior is the same. We have a dll which is the bridge between CR and the application, this is the interface that handles the calls to the report and as we have a lot of reports, we used to convert this component from C++ to C++/CLI and we kept the .rpt files without conversion. If I open the .rpt file in the last CR designer version and save the file, the behavior is the same.  I've done some research regarding this and I've not found anything that could help, because I'm receving the error when I'm trying to load the report. Once again, this is not regarding permissions because I'm able to load a lot of .rpt files.

I've just done a quick C# code in a simple windows form project and the behavior is the same, I've tried all these options without success. Am I missing something?

                CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

                report.Load(@"C:\arinvedtWtAmt.rpt", CrystalDecisions.Shared.OpenReportMethod.OpenReportByTempCopy);

                report.Load(@"C:\arinvedtWtAmt.rpt", CrystalDecisions.Shared.OpenReportMethod.OpenReportByDefault);

                report.Load(@"C:\arinvedtWtAmt.rpt");

                report.ReportClientDocument.Open(@"C:\arinvedtWtAmt.rpt", 0);

Exception thrown in Load:

CrystalDecisions.Shared.CrystalReportsException was caught

  HResult=-2146232832

  Message=Load report failed.

  Source=CrystalDecisions.CrystalReports.Engine

  StackTrace:

      at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()

      at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob)

      at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod)

      at WindowsFormsApplication17.Form1.Form1_Load(Object sender, EventArgs e) in c:\Users\rmujica\Documents\Visual Studio 2012\Projects\WindowsFormsApplication17\WindowsFormsApplication17\Form1.cs:line 29

  InnerException: System.Runtime.InteropServices.COMException

      HResult=-2147483142

      Message=

Invalid table number.

arinvedtWtAmt 40276_44480_{0B6283D9-4446-4EE7-A5F0-E14EAE5AD4D7}.rpt

      Source=Analysis Server

      ErrorCode=-2147483142

      StackTrace:

            at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options)

            at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options)

            at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()

      InnerException:

I really appreciate any advice here. Thanks!

Roberto M.

EDIT1: if I try the next code

this.crystalReportViewer1.ReportSource = @"C:\arinvedtWtAmt.rpt"

I have the attached alert from the Crystal Report Windows Forms Viewer.

EDIT2: I'm sending a copy of the report without any content just in case you are interested. Note that I've added the .txt. This file is .rpt.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Roberto,

Same for me. Do you have the report before you deleted everything?

Likely what has happened is some data source was not available or needed an update and since CR cannot find the faulty connection info it can't fix the rpt file.

Could be a datasource we no longer support and no driver for it now.

Don

Former Member
0 Kudos

Hi Don,

Thanks for your answer. Is there another way to send this .rpt file in a private way? There are some policies in the company that I work and I do not want to break some rules making this - or any other - file public.

Thanks!

Roberto M.

Former Member
0 Kudos

Hi Don,

I've sent the original file using dropbox. The link was provided in a DM.

Thanks,

Roberto M.

0 Kudos

Hi Roberto,

Same problem with the original report....

I did find out though if you open the report and click on Show SQL.... it prompts for the values which I fill in and then attempts to log on and I just use my SQL Server so I don't have your Tables so it prompts to remove the tables and I click No on both but then it pops up this message box but I don't know if this is an error in the connection info or the parameter values I used:

So it could be the values I am inputting or it could be something in the report is not talking to my DB nicely.

What values should I use?

Also, with newer DB's you need to update the client from the MDAC OLE DB Provider to the SQL Native 10 or 11 client. That may fix the problem. I connected to SQL 2008, without the data source I can't do much more.

See if updating the client resolves the problem. MDAC OLE DB Provide is not fully supported by MS connecting to the newer servers.

You may want to try using ODBC to see if that fixes the report, sometimes switch drivers can resolve these errors, it flushes the saved info in the rpt file.

Also, why have the one table attached but no field in it are used? I assume you are not using at runtime of course. If it is not used then delete it.

Don

Former Member
0 Kudos

Hi Don,

I just provide number or string according I see in parameter. I do not having so much troubles on this but yep, you will need my source. I just saw that in my original report the table is attached and not used, a bad thing that we have but in any case I do not think that this is something related... I'm using SQL2012 and I tried removing all the connections... but I just simply do not get it.

I thought that maybe if I change this, my report will be executed succesfully in C# but nothing happened... what it is wrong?

I just created a table like this:

(using SQL2008)

create table myTEST

(

  hello int

)

insert into myTEST

select 1

and point my .rpt to this table (creating a new connection in 2008 maybe? or odbc?).

I can visualize the report in designer, but I'm still getting the error in the code.

https://dl.dropboxusercontent.com/u/38214815/example.zip

What I'm trying to do is just to discover what it is happening here with my simple fail.rpt report and once that I have it, I could try to fix it on my original .rpt.

Is there a way to do a copy of this report in a new one as a workaround of this?

0 Kudos

Hi Roberto,

What I suggested by changing the Database info to ODBC and OLE DB and then back to the original by using Set Database location in CR Designer was to try to fix the RPT file.

It errors in the SDK because the SDK loads all of the properties into memory on .Load(), if there is a problem the engine will not open the report. CR Designer can work around or ignore some property, because if it is not used then CRD ignores it.

Possibly what may have happened is the rpt file itself may have been corrupted when saving to disk and the SDK has no way to fix it.

If changing datasources in CR Designer doesn't fix the problem the only way to fix the report is to create a new one.

Don

Former Member
0 Kudos

You are right!.

I do not what I've done but this is working now . I've just played with the connections a little bit: I've created a new one to EXCEL (previously sql) and removed everything else then I've saved the report, after that and once again I've created a new one but this time with sql provider. Obviously these are the simple steps because I think that I've done that before. I wish that I could realize what is the extra thing that I did but I think that the main idea is to reset the info trying to set a totally different connection! So, If I could advice to someone here, I could say that you will need to play with all the connections. As you said Don, I think that this is all related with database info. 

Thank you so much!

Roberto M.

Edit: By the way, I'm remembering that, once that I had the sql connection, I found 2 properties that I considered not related to SQL. I've delete them manually. If you are having issues with this, another good advice is to compare the properties between one that is working and one the isn't.

Answers (0)