Quantcast
Viewing all articles
Browse latest Browse all 3636

Failed to Retrieve Information from the Database

Background: I've got a C# application which utilizes the Crystal Report Engine for .NET Framework 4.0 (Code below). The Crystal Reports it connects to access Oracle directly, but my application feeds them the connection string they are to use. There are 60+ reports that my application cycles through.

As I understand it there are two pieces to that, one being the Crystal Report must be set to the Data Source using the same account details as the connection string, the other being the connection string passed in.

 

When the Crystal Report and Application use the Schema Owner as the connection string the application works fine. It cycles through all of the reports, and prints them out.

When I use a different user account (which is limited to only what this application needs) it fails on the second report. Not the first report. The first report works just fine, and the second report gets the below error: Message: Failed to retrieve data from the database. Details:  [Database Vendor Code: 942 ] Failed to retrieve data from the database. Error in File [Crystal Report Name]

What I find strange is that the first and second report are identical in terms of which Oracle Objects they utilize.

Does Crystal Report Engine require any special permissions beyond Select? Is there potentially something else amiss?

 

//CR is an Instance of ReportDocument class, DBCnnctn is a class that pulls Connection info from an XML file
cr.Load(sReportPath + ReportName);
//Set the connection Info to be what is stored in the global variables and apply them to all the tables in the
//report, and all tables in each sub report
crConnectionInfo.ServerName = DBCnnctn.sDS;
crConnectionInfo.DatabaseName = "";
crConnectionInfo.UserID = DBCnnctn.sUID;
crConnectionInfo.Password = DBCnnctn.sPW;
cr.RecordSelectionFormula = rSelFormula + CycleNum;
cr.SummaryInfo.ReportTitle = CycleNum + " " + ReportName;
SetDBLogonForReport(crConnectionInfo, cr);
SetDBLogonForSubReport(crConnectionInfo, cr);
rpt.ReportSource = cr;
rpt.Refresh();                
cr.PrintOptions.DissociatePageSizeAndPrinterPaperSize = false;
cr.ExportToDisk(ExportFormatType.PortableDocFormat, ReportName + CycleNum + ".pdf");
cr.Close();

If there are any additional details that I can provide to help, let me know.


Viewing all articles
Browse latest Browse all 3636

Trending Articles