on 04-16-2014 8:42 AM
I'm using a Crystal Report Viewer in my .Net app and i use the following code to relocate tables in my 'normal' RPT reports:
With crConnectioninfo
.ServerName = <<DSN Name>>
.DatabaseName = <<Database Name>>
.UserID = <<ODBC User ID>>
.Password = <<ODBC User Password>>
End With
crRpt.Load(<<Full path to Crystal Report>>)
crTables = crRpt.Database.Tables
Dim crTable As CrystalDecisions.CrystalReports.Engine.Table
For Each crTable In crTables
crTableLogoninfo = crTable.LogOnInfo
crTableLogoninfo.ConnectionInfo = crConnectioninfo
crTable.ApplyLogOnInfo(crTableLogoninfo)
Next
ReportViewerCR.ReportSource = crRpt
It all works perfectly when i use a 'Normal' Crystal report i.e. any RPT file
However, when i use a Read-Only Crystal Report, RPTR, the code fails at the line
crTable.ApplyLogOnInfo(crTableLogoninfo)
and i get the following error message:
"Illegal operation on Crystal Reports Read-Only (RPTR) report. Please check release notes to get more information"
Can anyone please help?
Many thanks,
Jan
RPTRs are read only. This means that they cannot be refreshed, so they cannot connect to a database. That is why you're getting the error - the report should be viewable without setting the logons.
-Dell
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Dell, for the reply.
I understand that RPTR's are read-only but here's the issue:
I've designed a report (RPT) and then converted it to Read-Only (RPTR) for someone that has 5 IDENTICAL databases (on the ONE SQL Server).
Therefore, the user should be able to run the report on ANY of the 5 databases (on the same server) as they all have the same tables/views/st procs.
In my application, i simply want to change the database (1 of 5) that the user should connect to when they want to run my report. Hence my, 'ApplyLogonInfo'
I'm not altering the structure of the report...... just setting it to point to a particular database.
If i can't change the database, do i have to create 5 Identical reports? Each pointing to a different database? sounds a bit extreme.....
Any ideas?
Many thanks
- Jan
Thanks Ido,
Using RPT files works perfectly within my app. My app properly re-allocates the databases.
The problem only lies with RPTR (Read-Only) files.
I take your point on-board about using rpt files..... but...... there's always a 'bright spark' at the end-users' place who thinks they know Crystal reports and try to alter your hard worked reports..... and end up screwing it up.....
That was why i though RPTR would be a god-send..... if your end-users cannot modify them.
But then, I cannot re-allocate the database (tables) in a .NET app for RPTR files.... which seem to defeat the purpose of RPTR files
What other (alternative) protection scheme do you recommend?
Any help will be greatly appreciated.
- Jan
By design, RPTR files can only connect and be refreshed if used with the same datasource as when the report was created. E.g.; your datasource is ODBC called test, you will not be able to connect to ODBC called test2. Nor can you change the connection method, etc. From the SAP Crystal Reports .NET SDK Developer Guide:
Crystal Reports Read-Only (RPTR) reports are Crystal reports that can be viewed with report viewer applications, but cannot be modified with the SDK or opened by report designer applications. This lets you protect your intellectual property by preventing users from modifying the report or obtaining information about proprietary business logic stored in the report definition.
Crystal Reports Read-Only format reports use the RPTR file extension instead of the RPT file extension used by Crystal reports. You can create an RPTR report by exporting an RPT report to RPTR format. However, there is no supported way to convert an RPTR report to an RPT report.
Because the definition of an RPTR report cannot be modified, you cannot use this SDK to set the data source location of an RPTR report through the database controller. However, you can refresh the data of an RPTR report at run time.
You cannot use this SDK to perform the following tasks:
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow us on Twitter
Thank you Ludek, for that clarification. Much appreciated.
I think RPTR reports are a fantastic idea, especially for developers to protect their intellectual property and more importantly, from users trying to modify the reports without clearing it with the developers.
However, i suppose it can go onto the "Wish List" - that developers should ideally be able to alter the logoninfo for the RPTR reports so that it can be used on multiple databases (albeit, without anyone being able to change the content/structure of the report - Developers can insert a (c) Copyright notice in the report, without the users being able to remove the copyright notice )
Regards,
- Jan
Hi Jan
I could easily go with that suggestion . SAP has a thing called the SAP Idea Place where you can suggest enhancements. I think ideas coming from customers carry a bit more weight than ideas from me, so if you want to... Let me know and I can tweet the idea, get it voted up and then we keep our fingers crossed.
- Ludek
Thanks Ludek....... yes, please tweet my suggestion. If it makes life
easier for developers, then I'm all for it....
My suggestion is as follows:
RPTRs are a fabulous idea.... however, the developer that develops the rpt
should have an option of exporting to RPTR with one of the following options:
1. Completely lock down the report to ONE DSN AND ONE DATABASE
Or
2. Lock down the report but allow the user (or another developer) to change the DSN and db location (BUT NOT ALTER
THE REPORT IN ANY WAY)
OR
3. Lock down the report and don't allow the user to change the DSN but DO allow change of db
In all the above cases, the original developer should be able to insert a copyright notice within the report that no-one
should be able to remove once converted to an RPTR. Copyright notice could appear as a 'Special Field'
The above, hopefully, is not too much to ask......
Best regards,
- Jan
Millet,
Yes i am also able to refresh report data using
Reportdocument.Refresh()
I am working on Oracle database with same DSN and User ( changing database in Tnsnames)
but it prompts for Password since dsn does not store the database password.
Please suggest if there is any way we can pass the password from code and suppress the prompt
Thanks in advance
Vinod
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.