Skip to Content
author's profile photo Former Member
Former Member

How to change connection string at runtime for Informix DB?


I am new to CR 2008 and Informix DB. My question is:

How to change the connection string for the CR at run time for Informix? how to input the DB instance into CR?

I tried the following code but failed to log onto DB:

Dim table As Table

Dim logonInfo As New TableLogOnInfo

For Each table In reportDoc.Database.Tables

logonInfo = table.LogOnInfo

logonInfo.ConnectionInfo.ServerName = "MyInformixInstance@MyInformixServer"

' logonInfo.ConnectionInfo.

logonInfo.ConnectionInfo.DatabaseName = "MyDBName"

logonInfo.ConnectionInfo.UserID = "MyUser"

logonInfo.ConnectionInfo.Password = "MyPassword"


table.Location = "MyDBName" & ":" & table.Name

Next table

any help will be appreciated.



Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Apr 14, 2011 at 04:32 PM

    Hi Paul,

    Is the report using ODBC to connect to your Informix database?

    When you try running the report, what happens? Do you get an error, does old data come up or is it still connecting to the original database?



    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Paul,

      Now I'm baffled.

      Dim crTable As CrystalDecisions.CrystalReports.Engine.Table
      Dim crReport As New ReportDocument
      For Each crTable In LoginReportDocument.Database.Tables
            crTable.LogOnInfo.ConnectionInfo.ServerName = "AS400"
            crTable.LogOnInfo.ConnectionInfo.UserID = "CRYSTAL_USER"
            crTable.LogOnInfo.ConnectionInfo.Password = "myPassword"

      Here's the code I have working in my project. I don't set the database property because AS400 doesn't use this. The only real difference is how you and I are instantiating the table object and I have a new ReportDocument.

      Give this a try and see what happens.

      Good luck,


Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.