how to set the report database via exist dbconnection

Stimulsoft Reports.WEB discussion
Post Reply
kevin163
Posts: 27
Joined: Fri Oct 17, 2014 9:18 am

how to set the report database via exist dbconnection

Post by kevin163 »

my db connection has some specific purpose to use.
so i want the report use the same db connection in my application,not the same connection string.is the same connection object.
i try to extened the stisqldatabase ,to set the db connection object via the construct function,but when i run the report,it has a exception see that:" cant't find the namespace StiExtended". the StiExtended is my extended class's namespace.

how should i change my code to use the exist connection object ?
kevin163
Posts: 27
Joined: Fri Oct 17, 2014 9:18 am

Re: how to set the report database via exist dbconnection

Post by kevin163 »

i try to use the report.RegData("name",existConnection);
it will execute sql at the specific connection,but not show the correct data in report.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: how to set the report database via exist dbconnection

Post by Alex K. »

Hello,

Please try to use the following code for change connection string in the report:
((StiSqlDatabase)report.Dictionary.Databases["Connection"]).ConnectionString = ""

also you can add the new connection from code:
report.Dictionary.Databases.Clear();
report.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", newConnectionString));

Thank you.
kevin163
Posts: 27
Joined: Fri Oct 17, 2014 9:18 am

Re: how to set the report database via exist dbconnection

Post by kevin163 »

thanks for reply.
i don't want to change the connection string. because if i change the connection string,it will create a new connection to the database.
i want to use the exist connection,but there is not function th set the connection direct.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: how to set the report database via exist dbconnection

Post by Alex K. »

Hello,

Unfortunately, it is not possible.
Let us know if you need any additional help.

Thank you.
Post Reply