Hi,
I need to change the connection string at run time. How can I do it? The reason is I had implemented the repoting at development environment, then later deploy it to other location (different server and SQL login info). What I want to do is just changing the connection string (sql created in report remain unchange).
For example :
the current connection string is "server=devcomp3; user id=sa; password=; database=dbLMS" and I need to change it to "server=SST-KKNS; user id=sa; password=12345; database=dbLMS".
I have searched through the forum but couldn't find a way to do it.
Many Thanks in advance.
ringo
How to change connection string at run time
How to change connection string at run time
Hello,
You can use following code:
Thank you.
You can use following code:
Code: Select all
report.Databases.Clear();
report.Databases.Add(new Stimulsoft.Report.Dictionary.StiOleDbDatabase("NameInReport", ConnectionString);
How to change connection string at run time
Thanks Jan.
Anywhere, I had found the way to do it:
report.Load("My report name");
StiSqlDatabase sqlDB = new StiSqlDatabase();
sqlDB = (StiSqlDatabase)report.Dictionary.Databases["My Database"];
sqlDB.ConnectionString="New Connection String";
report.Render();
Anywhere, I had found the way to do it:
report.Load("My report name");
StiSqlDatabase sqlDB = new StiSqlDatabase();
sqlDB = (StiSqlDatabase)report.Dictionary.Databases["My Database"];
sqlDB.ConnectionString="New Connection String";
report.Render();
-
- Posts: 35
- Joined: Tue Nov 09, 2010 2:43 pm
- Location: iran
How to change connection string at run time
Hi every body.
I sea allmost all topic in forum and seem int all of them posit that we know what is our tables and columns in dataset of our reportbut allways not thus
1-sometime we may want to edit the report in webdesigner that we dont know any thing about its data set but we sure it works with our data base , so befor call the design() function we pass what data set to our report via regdata(//what_dataset) ??
2- or we may want to set full access to data base to one user to create the every report that need to design well we pass a full data base to designer dictionary and he/she design every report by every columns in every tables or viwes in database and save it , in viwe report mode namely after load our report and we want to pass it to stiwebviewer we pass what data set to it since we cant pass all data base to our report ??!
I sea allmost all topic in forum and seem int all of them posit that we know what is our tables and columns in dataset of our reportbut allways not thus
1-sometime we may want to edit the report in webdesigner that we dont know any thing about its data set but we sure it works with our data base , so befor call the design() function we pass what data set to our report via regdata(//what_dataset) ??
2- or we may want to set full access to data base to one user to create the every report that need to design well we pass a full data base to designer dictionary and he/she design every report by every columns in every tables or viwes in database and save it , in viwe report mode namely after load our report and we want to pass it to stiwebviewer we pass what data set to it since we cant pass all data base to our report ??!