Dynamically Set Data Source Location
I have an ASP application where user selects a site code from a drop down list. Each site code points to a different server. Now when I run my Crystal Report using the report viewer I would like to set the server name dynamically:
Example:
Site code RGWP equals
Remote Server \\10.xxx.0.254:211
Database: C:\Program Files\Astec Industries\WM2000\Data\WM2000DATA.add (data source location)
Site code RGDF equals
Remote Server \\10.yyy.0.254:211
Database: C:\Program Files\Astec Industries\WM2000\Data\WM2000DATA.add (data source location)
This is the code I have:
Code:
myCrystalReport1.SetDataSource("C:\Program Files\Astec Industries\WM2000\Data\WM2000DATA.add")
myCrystalReport1.SetParameterValue("BatchGuid", BatchGuid)
myCrystalReport1.SetDatabaseLogon(System.Configuration.ConfigurationManager.AppSettings("CrystalReport_UserId"), System.Configuration.ConfigurationManager.AppSettings("CrystalReport_Password"))
CrystalReportViewer1.ReportSource = myCrystalReport1
CrystalReportViewer1.Zoom(90)
I don't know how and where to set the server name.