Hello,
I have currently created a .dplx file with several sub reports that work well when called in C# .cs files and draw to web method with embedded connection string, stor procedure, parameters.
1.) What I would prefer is to not embed any of the connection strings within the .dplx file, since we move servers (staging + production) often. With this being said we would like to pull the connection string for the web.config file (relative to each server) in the .cs file. I know this is most likely possible but the examples as provide are somewhat simple.
2.) secondly is is possible to keep the subreports with the parameter embeded (same stor proc) but pull the connection as above without rewriting the report and its implementation entirely.
Know its a specific question but any code snippet you might be able to provide may be helpful.
Thanks in advance for your time.
Application Connection String
Re: Application Connection String
Support · Mar 5, 2008You can actually define your Report's Connection String (inside of Designer) so that the connection value will be pulled right from the config file. For example, you can place the following string in your Report Query's Connection String:
#Global.AppSettings["NorthwindConnectionString"]#
Then, if you have defined an AppSettings node in your config file with a matching name (NorthwindConnectionString) then the appropriate information will be used. The web.config file may have an entry like:
<appSettings>
<add key="NorthWindConnectionString" value="Data Source=localhost;Initial Catalog=northwind;user id=sa;pwd=;"/>
</appSettings>
You should be able to leave everything else in your report and subreport the way you have it. I believe that the SimpleReport_StoredProc example included with our product will demonstrate this exact thing.
Thanks,
ceTe Software Support Team