I have the below code in my aspx.cs to login to the DB. The acutal values are stored in web.config. However, when I changed the IP of the DB to the production DB in my web.config, it keeps prompting me for login information. The reports are using the old IP. I then need to go back to CR and change the properties of datasource location for the reports to work. Why is it ignoring the code below?
private void ConfigureCrystalReports()
{
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = ConfigurationManager.AppSettings["ServerName"];
connectionInfo.DatabaseName = ConfigurationManager.AppSettings["Database"];
connectionInfo.UserID = ConfigurationManager.AppSettings["UserID"];
connectionInfo.Password = ConfigurationManager.AppSettings["Password"];
SetDBLogonForReport(connectionInfo);
CrystalReportViewer.HasCrystalLogo = false;
CrystalReportViewer.HasRefreshButton = true;
}
private void Page_Init(object sender, EventArgs e)
{
ConfigureCrystalReports();
}
private void SetDBLogonForReport(ConnectionInfo connectionInfo)
{
TableLogOnInfos tableLogOnInfos = CrystalReportViewer.LogOnInfo;
foreach (TableLogOnInfo tableLogOnInfo in tableLogOnInfos)
{
tableLogOnInfo.ConnectionInfo = connectionInfo;
}
}
any advice appreciated
ss