Giving values to crystal report from app.config file

Generally we need to use crystal report in our application and it may happen more than crystal report share same headers, putters for ex address, name etc. so we need not write these values on every crystal report saperately, we can pass it from app.config
like this

<Configuration><appSettings>
<add key="cname" value="mayur"/>
<add key="address" value="address of mayur"/>
</appsettings></configuration>


now on form on which you are displaying crystal report do following things
using system.Configuration

string name=ConfigurationManager.Appsettings.Get("cname");
string addr=ConfigurationManager.Appsettings.Get("address");
ReportDocument obj=new ReportDocument();
obj.load("path of report");
crystalreportviewer.ReportSource=obj;
obj.SetparameterValue("your parameter name in crystal report for name",name);
obj.SetparameterValue("your parameter name in crystal report for address",addr);

Ebook Download
View all
Learn
View all