on 11-07-2014 2:32 PM
Hi all
I've "succeeded" in generating a reportdefinition dynamically (using only C# code, didn't do any creating/defining in the Designer), based on choices made by the user of my application:
"succeeded", because the report definition looks ok - it contains the correct CommandTable definition, the correct subreports are imported.
When i try to view it in the designer, it looks ok, it even produces the wanted results
BUT: When viewing the report, i have to enter manually the password for the mainreport and for each subreport.
When i create a report using the Designer i have to enter it only once, and it seems the credentials are then passed on to the subreports.
This is also true when using an exporting tool like CRExport, that enters the login and password in the mainreport, but not in the subreports:
CRExport works perfectly for Designer-created reports containing subreports, but not for reports that were created by my code which is - of course - the point of the application.
Obviously i'm missing something.
I've used this tool to generate the necessary code, but even when trying this in a simple standalone testapplication, with most of the things hardcoded, i can't seem to get it to work. (I used the tool on a working report, only changed the content of CommandText)
Could someone please tell we what i have to set in the mainreport/subreports to make the logoninformation from the mainreport be passed on to the subreports?
Version: CR 2011
Hi Michael
First, we need to get the actual number of CR you are using as CR 2011 does not install any SDK. SDK is installed via "SAP Crystal Reports, Developer Version for Visual Studio .NET" (assemblies would be version 13.x) or the BI Platform (assemblies would be version 14.x).
Next, assuming you are using "SAP Crystal Reports, Developer Version for Visual Studio .NET", make sure you have applied Service Pack 12:
Taking a shot in the dark as to the cause; if the datasource for the report and subreport is different, the subreport will prompt - unless provided with a correct log on. The difference could be that the main report is using ODBC, subreport is using OLE DB. So check the subreport logons n the desingner for any differences.
One thing I am not clear on; do you get the subreports prompting in both the CR desinger and at runtime?
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow us on Twitter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ludek
First of all, thanks for the quick reply.
The versions that are installed are the following:
==> All the RAS assemblies are 13.x
What do you mean with "if the datasource for the main and the subreport are different?"
The application that generates the report definitions sets identically the same connection information in all the subreports and in the main report. All connect to the same database\instance and DB
The login and password parameters that are provided there are correct, since generating the report definition also automatically inserts all returned fields in a basic layout, which means it can connect to the db, execute the query from the command table and sniff out the fieldnames.
There are some things that feel a little weird:
1. if i create the same main and subreport manually with the designer (exactly the same command table, same linking parameter with subreport, same connection definition) it works.
2. I wrote a small test application to see if the connection information that i saved is effectively written to the .rpt file. As it turns out, only part seems to be:
When creating the same report (and subreport) with the designer, the value for user is "mylogin", and the value for "QE_SQLDB" is "True". So the designer behaves differently (or i need to do something to make the RAS assemblies behave the same as the designer, but i don't know what...)
3. With the "designer-generated" report definitions, the designer asks only once for the credentials when running the report <--> with the RAS-generated report definitions, the designer asks for credentials for the mainreport and for EVERY subreport
thanks in advance for looking into this
Hi Michael
re.: What do you mean with "if the datasource for the main and the subreport are different?"
Say the connection for the main report is ODBC, subreport is OLEDB, or main report is ODBC conn1, subreport is ODBC conn2, etc. From your description, this is not the case so that is good.E.g.; if the main rpt and subrpt use the same connection, the subreport essentially piggy backs on the main report connection.
I am not able to explain the differences in behavior, but I do have a couple of suggestions:
1) See if using code that will force the subreport to log on will help. Something like the code described here:
KBA: 1688540 - How to login to subreport using Crystal Report .Net SDK
2) The following KBA has a utility that you can download and it will write out the logon code for you. Compare that to the code you are using, see if this will work:
KBA: 1553921 - Is there a utility that would help in writing database logon code?
Oh. One more thing. If yuo are using MS SQL, please keep the following in mind:
For OLE DB use:
MS SQL 2005 - OLE DB Provider
MS SQL 2008 - SQL Native 10
MS SQL 2012 - SQL Native 11
MS SQL 2013 - SQL Native 11
For ODBC use:
MS SQL 2005 - SQL Native
MS SQL 2008 - SQL Native 10
MS SQL 2012 - SQL Native 11
MS SQL 2013 - SQL Native 11
- Ludek
UPDATE: for now i am able to generate reports with CrExport where the connection credentials seem to be pushed through to the subreports. However, the reporting webapplication where the reports will also be placed doesn't seem to be able to do it correctly. I've noticed that it still uses version 13.0.4 of the RAS assemblies...
I don't know how i got this far, but it seems to be a combination of
* redefining the default report that i always start from to have a dummy commandtable (CommandText = "Select 1")in it with a connection to the right server.
* NOT trying to overwrite the connectioninfo on the tables, although even in this case, it's weird that the value of QE_SQLDB is being set to false and the user is set to null when saving a copy of the document using SaveAs)
* switching between SQLOLEDB and SQLNCLI11 didn't make any difference....
For good measure, the general overview of what i do now (for each (sub)report) is...
------START SNIP------
//CR Declarations
CrystalDecisions.CrystalReports.Engine.ReportDocument document;
ISCDReportClientDocument m_boReportClientDocument;
//Create a new ReportDocument
document = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
//Access the ReportClientDocument in the ReportDocument (EROM bridge)
m_boReportClientDocument = document.ReportClientDocument;
//create new report document
String templateBaseFolder = config.algemeneInstellingen[Constants.REPORTS_TEMPLATES].getWaardeString();
String templateReportKey = landscape ? Constants.TEMPLATE_LANDSCAPE : Constants.TEMPLATE_PORTRAIT;
m_boReportClientDocument.Open(templateBaseFolder + "\\"+config.algemeneInstellingen[templateReportKey].toString());
//get the existing command table and Clone it
l_boTable = boTables[0].Clone(true) as CommandTable;
//add parameters
...
//set command text
...
//set password and replace table in the table list
l_boTable.ConnectionInfo.Password = getPassword();
boTables[0] = l_boTable;
//replace table location as seen in official examples
document.ReportClientDocument.DatabaseController.SetTableLocation(boTables[0], l_boTable);
//check if connection to database works correctly
document.VerifyDatabase();
//add result fields to details section
addFields();
document.ReportClientDocument.SaveAs(reportNaam,config.algemeneInstellingen[Constants.REPORTS_BASEFOLDER].toString());
document.ReportClientDocument.Close();
-------END SNIP------
Each subreport is saved, closed and added to the main report before the main report is saved and closed.
The subreports are each put in their own details section, and linking is setup accordingly. All of this works correctly.
any suggestions as to how i might be able to get the other software to work? My only angle here now is the difference in assembly versions between the "reporting server" (13.0.4.x) and my pc (13.0.12.x)... but i'm reluctant to have one of the sysadmins upgrade the version, since i don't know if this might break something?
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.