Page 1 of 1

how to set the report database via exist dbconnection

Posted: Mon Dec 01, 2014 7:17 am
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 ?

Re: how to set the report database via exist dbconnection

Posted: Tue Dec 02, 2014 7:03 am
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.

Re: how to set the report database via exist dbconnection

Posted: Tue Dec 02, 2014 10:57 am
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.

Re: how to set the report database via exist dbconnection

Posted: Wed Dec 03, 2014 8:33 am
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.

Re: how to set the report database via exist dbconnection

Posted: Thu Dec 04, 2014 8:16 am
by Alex K.
Hello,

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

Thank you.