Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Changing Connection parameters in a Crystal 11 report

Posted on 2006-05-05
Medium Priority
Last Modified: 2008-01-09
I have a crystal 11 report, running from a SQL server stored procedure.

I am using VB6 code to run the report.
I am using CRAXDDRT in the VB6 project.

I am using the ConnectionProperties of the table to set the security, server and initial catalog.

the problem is, if I want to change the name of the SQL server database (for upgrading purposes), the report still attempts to connect to the old database name.

This is causing a problem because if the original database does not exist the program will not run.

Any ideas?
Question by:PaulPattinson
  • 4
  • 3
LVL 101

Expert Comment

ID: 16623097
Does your report have subreports?


Author Comment

ID: 16624604
Yes. It has 3 subs.

Author Comment

ID: 16624708
The subreport connection properties are being set using the same logic as the main report.
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

LVL 101

Expert Comment

ID: 16625654
Can you show the  code?


Author Comment

ID: 16629053
This is the code i am using to set the connection paramrters for each table in the report/subreports :

I took this from the Crystal Reports Technical reference guide . pdf

Private Sub SetTableLogonInfo(i_objReportTable As CRAXDDRT.DatabaseTable)

Dim objConnectionProperty As CRAXDDRT.ConnectionProperty
Dim strLocation As String

        Set objConnectionProperty = i_objReportTable.ConnectionProperties("Integrated Security")
        objConnectionProperty.Value = True
    'Get the Datasource Property of the Table and set it with the server name
    Set objConnectionProperty = i_objReportTable.ConnectionProperties("Data Source")
    objConnectionProperty.Value = m_strServerName
    'Get the Initial Catalog Property of the Table and set it with the database name
    Set objConnectionProperty = i_objReportTable.ConnectionProperties("Initial Catalog")
    objConnectionProperty.Value = m_strDatabaseName
    Exit Sub

Accepted Solution

PaulPattinson earned 0 total points
ID: 16630236
I have managed to fix this.
I have used the following code :

i_objReportTable.ConnectionProperties.Add "Integrated Security", True
i_objReportTable.ConnectionProperties.Add "Data Source",m_strServerName
i_objReportTable.ConnectionProperties.Add "Initial Catalog",m_strDatabaseName
i_objReportTable.ConnectionProperties.Add "Provider","SQLOLEDB"

Seems to work ok using this method.

Not too sure why i have to delete and recreate the connection properties for reports that run from a stored procedure.

Reports that run from SQL tables worked with the previous code.

LVL 101

Expert Comment

ID: 16636307
NOt sure either unless there is some difference in a connection to an SPP when compared to a view or table.


Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month10 days, 23 hours left to enroll

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question