cancel
Showing results for 
Search instead for 
Did you mean: 

Database logon failed when export to PDF

Former Member
0 Kudos

Hi,

Currently I'm building a .NET application that will update the report data source that has been deploy to CR server. The deployed report is retrieving data from text-based file.

The source data are in text files(.txt) instead of databases(SQL, Oracle)

Following are the lines of codes that I have start with:

boInnerPropertyBag.Add("Database Name", strSourcePath); //c:\temp\ReportSource.txt

boInnerPropertyBag.Add("Database Type", "Text");

//Set the attributes for the boMainPropertyBag

boMainPropertyBag.Add("Database DLL", "crdb_dao.dll");

boMainPropertyBag.Add("QE_DatabaseName", strSourcePath); //c:\temp\ReportSource.txt

boMainPropertyBag.Add("QE_DatabaseType", "Text");

//Add the QE_LogonProperties we set in the boInnerPropertyBag Object

boMainPropertyBag.Add("QE_LogonProperties", boInnerPropertyBag);

boMainPropertyBag.Add("QE_ServerDescription", strSourcePath); //c:\temp\ReportSource.txt

boMainPropertyBag.Add("QE_SQLDB", "False");

boMainPropertyBag.Add("SSO Enabled", "False");

ConnectionInfo newConnectionInfo = new ConnectionInfo();

newConnectionInfo.Attributes = boMainPropertyBag;

newConnectionInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindMetaData;

rptClientDoc.DatabaseController.ReplaceConnection(oldConnectionInfo, newConnectionInfo, null, CrystalDecisions.ReportAppServer.DataDefModel.CrDBOptionsEnum.crDBOptionDoNotVerifyDB);

rptClientDoc.RowsetController.Refresh();

    

No error occur on ReplaceConnection but when it comes to the following code an error "Database logon failed":

PrintOutputController rasPrintOutputController;

                                    CrystalDecisions.ReportAppServer.ReportDefModel.CrReportExportFormatEnum rasReportExportFormat;


                                    rasReportExportFormat = CrystalDecisions.ReportAppServer.ReportDefModel.CrReportExportFormatEnum.crReportExportFormatPDF;

                                    rasPrintOutputController = rptClientDoc.PrintOutputController;

                                    Byte[] myBytes = (rptClientDoc.PrintOutputController.Export(rasReportExportFormat, 0).ByteArray);

I can't seem to find sample where the data source is in text-based.

Am I setting the correct property details on the data source?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Anyone has an idea how to solve the database logon issue? Or is there anything wrong with my coding?

Any help is very much appreciated.

Thanks and regards,
Derrick Tan

former_member186271
Participant
0 Kudos

Please try deleting rptClientDoc.RowsetController.Refresh();

Former Member
0 Kudos

Hi Jeff,

I tried already, the code run without error, but the data still remains the same even i changed the connection to point it to another text file with different data set.

Is there any other way to refresh the report before export it out in PDF?

Thanks and regards,
Derrick Tan

DellSC
Active Contributor
0 Kudos

What version of Visual Studio are you using and what version of the Crystal SDK?

-Dell

Former Member
0 Kudos

Hi Dell,

Software that we used:
1) SAP Crystal Report 2013
2) SAP Business Object BI Platform 4.1 SP 3
3) SAP Business Object BI Platform .NET SDK Redistributable 64 bit 4.1 SP 3

Currently we are using the SAP crystal report 2013 to create the crystal report then deployed the report to BIP 4.1 SP3. Then, the code will change the data source path at runtime, refresh and export the report to PDF.

Thanks and regards,
Derrick Tan

DellSC
Active Contributor
0 Kudos

What version of Visual Studio?  It needs to be VS 2010 or higher.

Also, are you just trying to view the report as a PDF or are you trying to export the PDF to a file?  If you're trying to export it to a file, then it may be easier to schedule the report to file.  If you're trying to view the report, it may be easier to use OpenDocument to view it.  Either way, I probably have sample code, I just need to know what you're trying to do.

-Dell

Message was edited by: Dell Stinnett-Christy

Former Member
0 Kudos

Hi Dell,

We are using Visual Studio 2010 to develop the app. We are trying to change the connection properties of the crystal report to another text file, then refresh the report so that new data will be fetched by the report before export in PDF to a local folder.

In my case, we not able to schedule the crystal report, because:

1) Data source is text file instead of database.
2) We will have multiple text file for 1 crystal report, for example after crystal report had fetched the data from 001.txt, export the report to PDF and send to a local folder, then we need to change the connection to 002.txt. The process will repeat until all text file had been processed. Therefore, if i have 20 text file, then i will have 20 same PDF report with different data set.

That is why we need to change the connection properties at run-time.

By the way, am i setting correct property details on the data source?Besides, since the data source is text file and it sitting in the same server as my crystal report server, then it should not prompt for database logon right?

Thanks and regards,
Derrick Tan