cancel
Showing results for 
Search instead for 
Did you mean: 

Directly printing works - but viewer fails with an error

Former Member
0 Kudos

Hey,

we are using: Crystal Reports 2011 and runtime for VS2010.

I open and print my reports via c#. The directly printing works fine. But the viewer don't works. It's really crazy, because directly printing and viewing are using the same methods for database login etc.

At preview a form with the crystalreportsviewer will be opened and the reportsource is being set. After that the viewer shows the progress box. After a short while the progress box disappears and the following error is shown:

-

-


Crystal Report Windows Forms Viewer

-

-


Die Abfragen zum Abrufen der für diesen Bericht erforderlichen Daten können nicht ermittelt werden.

Daten konnten nicht aus Datenbank abgerufen werden.

Fehler in der Datei CS_201001_u {5BF5FF1B-C662-4A1E-80CA-B4BEB0124295}.rpt:

Daten konnten nicht aus Datenbank abgerufen werden.

-

-


OK

-

-


Translated in english:

-

-


Crystal Report Windows Forms Viewer

-

-


The queries to retrieve the required data for this report can not be determined.

Fehler in der Datei CS_201001_u {5BF5FF1B-C662-4A1E-80CA-B4BEB0124295}.rpt:

Data could not be retrieved from database.

-

-


OK

-

-


But the database logon methods etc. are all the same as at directly printing. What could it be?


            this.crystalReportViewer.ShowPrintButton = false;
            this.crystalReportViewer.ReportSource = pMainCRWReport;
            this.crystalReportViewer.ShowProgressAnimation(this._DruckOptionen.ShowDruckstatus);

            if (pPreviewOptions.Zoomlevel == 1 || pPreviewOptions.Zoomlevel == 2 ||
                (pPreviewOptions.Zoomlevel >= 25 && pPreviewOptions.Zoomlevel <= 400))
            {
                this.crystalReportViewer.Zoom(pPreviewOptions.Zoomlevel);
            }


                            pMainCRWReport.PrintToPrinter(pReport.Druckoptionen.AnzahlKopien,
                                                          pReport.Druckoptionen.KopieSeitenSortiert,
                                                          pReport.Druckoptionen.StartPage,
                                                          pReport.Druckoptionen.EndPage);

pMainCRWReport is ReportDocument.

Accepted Solutions (1)

Accepted Solutions (1)

former_member183750
Active Contributor
0 Kudos

On click of the print button, there is a postback happening back to the server and to me it looks like the connection to the DB is lost.

Are you using postbacks or sessions in your app?

- Ludek

Former Member
0 Kudos

Yes, it looks like that. I don't use postbacks or sessions.

I have inserted the following code just before the ReportSource of the viewer will be set.


ReportDocument doc = (ReportDocument)pMainCRWReport;
foreach (Table table in doc.Database.Tables)
{
       MessageBox.Show(string.Format("{0}: {1}", table.Name, table.TestConnectivity().ToString()));
}

All TestConnectivity returning true!

-

-


CrystalDecisions.CrystalReports.Engine.InternalException: Daten konnten nicht aus Datenbank abgerufen werden.

Details:

Daten konnten nicht aus Datenbank abgerufen werden.

Fehler in der Datei CS_201001_u {870C483C-D947-4FEA-A1C6-1AD0DC4A2805}.rpt:

Daten konnten nicht aus Datenbank abgerufen werden.

Details: ---> System.Runtime.InteropServices.COMException (0x800002D3): Daten konnten nicht aus Datenbank abgerufen werden.

Details:

Daten konnten nicht aus Datenbank abgerufen werden.

Fehler in der Datei CS_201001_u {870C483C-D947-4FEA-A1C6-1AD0DC4A2805}.rpt:

Daten konnten nicht aus Datenbank abgerufen werden.

Details:

bei CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.GetPage(PageRequestContext pPageRequestContext)

bei CrystalDecisions.ReportSource.EromReportSourceBase.GetPage(PageRequestContext pageReqContext)

--- Ende der internen Ausnahmestapelüberwachung ---

bei CrystalDecisions.Windows.Forms.ReportDocumentBase.GetPage(Int32 pageN)

bei CrystalDecisions.Windows.Forms.DocumentControl.ShowNthPage(Int32 PageNumber)

bei CrystalDecisions.Windows.Forms.DocumentControl.ShowFirstPage()

bei CrystalDecisions.Windows.Forms.PageView.ShowFirstPageEx()/

-

-


OK

-

-


The error -243 is an informix error:

Could not position within a table table-name.

The database server cannot set the file position to a particular row within the file that represents a table. Check the accompanying ISAM error code for more information. A hardware error might have occurred, or the table or index might have been corrupted (truncated). Unless the ISAM error code or an operating-system message points to another cause, run the oncheck utility (secheck with IBM Informix SE or tbcheck with IBM Informix OnLine) to check and repair table and index.

It seems to be that the viewer can't read the records with are locked within a transaction. I don't understand why the direct printing works. Is it possible to set the ISOLATION LEVEL for the report database connections?

I have tried this note but it don't works.

Former Member
0 Kudos

I disabled transactions in my application and getting the following error:

-244

-


Could not do a physical-order read to fetch next row.

The database server cannot read the disk page that contains a row of a table. Check the accompanying ISAM error code for more information. A hardware problem might exist, or the table or index might have been corrupted. If the query was using the dirty read isolation level, this error code may be normal behavior caused by reading data that was in a temporarily inconsistent state from a concurrent update on the same data.

Unless the ISAM error code or an operating-system message points to another cause, run the oncheck utility (secheck with IBM Informix SE or tbcheck with IBM Informix OnLine) to check and repair table and index.

I can't understand why crystal reports cannot read the data.

Former Member
0 Kudos

Is there a logfile I can enable to see what crystal report is doing?

former_member183750
Active Contributor
0 Kudos

Try this:

[1470978 - How to enable/disable crpe logging for the Crystal Reports .NET SDK|http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_bi/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes%7B6163636573733d36393736354636443646363436353344333933393338323636393736354637333631373036453646373436353733354636453735364436323635373233443330333033303331333433373330333933373338%7D.do]

Another test;

A one line win app:

CrystalReportViewer1.ReportSource = (<path to report>)

No DB logon, no params, no other code. Let the report do the prompting for you. Are you able to print using this small test?

- Ludek

Former Member
0 Kudos

It's just crazy... The error has gone, but I changed nothing. Now the viewer runs a few hours and just ignores the record selection formular (sql where).

I let it run the whole night and this morning it was ready with 65000 Pages and 1,5 GB memory usage.

-

-


System.OutOfMemoryException: Eine Ausnahme vom Typ "System.OutOfMemoryException" wurde ausgelöst.

bei CrystalDecisions.CrystalReports.TSLV.TSLVReader.ReadHeader(Boolean& isEnd, Boolean bSkipToNextRecord)

bei CrystalDecisions.CrystalReports.ETFTotallerTreeFactory.TotallerTreeFactory.loadETF(TSLVReader tslvReader)

bei CrystalDecisions.CrystalReports.ETFTotallerTreeFactory.TotallerTreeFactory.buildTotallerTree(Stream fileStream)

bei CrystalDecisions.CrystalReports.ETFTotallerTreeFactory.TotallerTreeFactory.GetTotallerTree(Stream stream)

bei CrystalDecisions.Windows.Forms.MainReportDocument.GetGroupTreeFromEngine(TotallerRequestContext context)

-

-


OK

-

-


Now I inserted the following code line:


this.crystalReportViewer.ViewTimeSelectionFormula = pMainCRWReport.RecordSelectionFormula;

And it works 😮

I cannot understand why I have to set the RecordSelectionFormula and the ViewTimeSelectionFormula. Is this the normal way?

Edited by: mbsmbs on Oct 28, 2011 10:32 AM

former_member183750
Active Contributor
0 Kudos

No. That is not "normal".

Something weird going on there...

- Ludek

Answers (0)