on 01-12-2016 4:59 AM
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?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please try deleting rptClientDoc.RowsetController.Refresh();
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What version of Visual Studio are you using and what version of the Crystal SDK?
-Dell
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.