How to set the Connection Info of the Report ?

Stimulsoft Reports.NET discussion
Post Reply
Stephan1
Posts: 122
Joined: Fri Aug 31, 2007 7:22 am
Location: Germany

How to set the Connection Info of the Report ?

Post 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
Brendan
Posts: 309
Joined: Sun Jul 16, 2006 12:42 pm
Location: Ireland

How to set the Connection Info of the Report ?

Post 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.
Stephan1
Posts: 122
Joined: Fri Aug 31, 2007 7:22 am
Location: Germany

How to set the Connection Info of the Report ?

Post by Stephan1 »

Thx, that worked fine.
Post Reply