Page 1 of 1

How to set the Connection Info of the Report ?

Posted: Wed Oct 24, 2007 5:02 am
by Stephan1
How can i set the Connection Info of my report ?

I got the following code to load the report

Dim stireport1 As New Stimulsoft.Report.StiReport
stireport1.Load(path) ' where path is the path of the report

how can i now set the connection of the report ?. in the report is saved trusted connection to a server.
i need to set manually another server for the data etc. ?

thx for you help

How to set the Connection Info of the Report ?

Posted: Wed Oct 24, 2007 8:30 am
by Brendan
Hi,
If you need to change the connection string for an SQL Server Database at runtime in the report you can do the following:

Code: Select all

Stimulsoft.Report.Dictionary.StiSqlDatabase sqlDB = report.Dictionary.Databases["MY_DB_NAME"] as Stimulsoft.Report.Dictionary.StiSqlDatabase;
if(sqlDB != null)
{
    sqlDB.ConnectionString = "My Connection String";
}
Where "MY_DB_NAME" is the name of the Connection source in your report.

How to set the Connection Info of the Report ?

Posted: Thu Oct 25, 2007 7:50 am
by Stephan1
Thx, that worked fine.