We have an app where user selects a site code. Remote sites have the same data base name but the server name is diffrenet. Using crystal report viewer to show report. Now, how can a dynamically change server name at run time?
Can I do something like this?
Try
Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo
myCrystalReport1.Load(myPath)
For Each myTable In myCrystalReport1.Database.Tables
myLogin = myTable.LogOnInfo
myLogin.ConnectionInfo.ServerName = myAdsIPAdress
myLogin.ConnectionInfo.DatabaseName =
"C:\Program Files\Astec Industries\WM2000\Data\WM2000DATA.add"
myLogin.ConnectionInfo.UserID =
"xxx"
myLogin.ConnectionInfo.Password =
"yyy"
myTable.ApplyLogOnInfo(myLogin)
Next
myCrystalReport1.SetParameterValue(
"Ask-Date", DropDownList2.SelectedValue)
CrystalReportViewer1.ReportSource = myCrystalReport1
CrystalReportViewer1.Zoom(90)