usamaalam
Jun 16th, 2008, 07:09 AM
Hello Everybody,
My application is developed with VS 2005 and crystal reports 10. It works fine on my local machine but when I try to run the app on the server where I deployed it, it uses the design time login credentials and hence doesn't allow me to see the report and throws following exception on the report page.
Logon failed. Details: ADO Error Code: 0x Source: Microsoft OLE DB Provider for SQL Server Description: Login failed for user 'sa'. SQL State: 42000 Native Error: Error in File C:\WINDOWS\TEMP\AlphaListing {1C4A8624-64C0-4721-B98D-68CC729163CE}.rpt: Unable to connect: incorrect log on parameters.
I am passing log on parameters using code and the username is not 'sa' which crystal report is trying to connect with. Here's the code as to how I am trying to show the report.
CrystalDecisions.CrystalReports.Engine.ReportDocument reportDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
string serverName = Sterling.JIDB.BusinessLogicLayer.DatabaseInfo.GetServerName();
string databaseName = Sterling.JIDB.BusinessLogicLayer.DatabaseInfo.GetDatabaseName();
string userName = Sterling.JIDB.BusinessLogicLayer.DatabaseInfo.GetUserName();
string password = Sterling.JIDB.BusinessLogicLayer.DatabaseInfo.GetPassword();
Response.Write(userName + "--" + password + "--" + databaseName + "--" + serverName);
reportDoc.Load(Server.MapPath("AlphaListing.rpt"));
reportDoc.Refresh();
reportDoc.SetDatabaseLogon(userName, password, databaseName, databaseName, true);
reportDoc.Refresh();
//reportDoc.SetDatabaseLogon(userName, password, databaseName, databaseName, true);
rptAlphaListing.ReportSource = reportDoc;
reportDoc = null;
Any ideas??
Thanks.
My application is developed with VS 2005 and crystal reports 10. It works fine on my local machine but when I try to run the app on the server where I deployed it, it uses the design time login credentials and hence doesn't allow me to see the report and throws following exception on the report page.
Logon failed. Details: ADO Error Code: 0x Source: Microsoft OLE DB Provider for SQL Server Description: Login failed for user 'sa'. SQL State: 42000 Native Error: Error in File C:\WINDOWS\TEMP\AlphaListing {1C4A8624-64C0-4721-B98D-68CC729163CE}.rpt: Unable to connect: incorrect log on parameters.
I am passing log on parameters using code and the username is not 'sa' which crystal report is trying to connect with. Here's the code as to how I am trying to show the report.
CrystalDecisions.CrystalReports.Engine.ReportDocument reportDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
string serverName = Sterling.JIDB.BusinessLogicLayer.DatabaseInfo.GetServerName();
string databaseName = Sterling.JIDB.BusinessLogicLayer.DatabaseInfo.GetDatabaseName();
string userName = Sterling.JIDB.BusinessLogicLayer.DatabaseInfo.GetUserName();
string password = Sterling.JIDB.BusinessLogicLayer.DatabaseInfo.GetPassword();
Response.Write(userName + "--" + password + "--" + databaseName + "--" + serverName);
reportDoc.Load(Server.MapPath("AlphaListing.rpt"));
reportDoc.Refresh();
reportDoc.SetDatabaseLogon(userName, password, databaseName, databaseName, true);
reportDoc.Refresh();
//reportDoc.SetDatabaseLogon(userName, password, databaseName, databaseName, true);
rptAlphaListing.ReportSource = reportDoc;
reportDoc = null;
Any ideas??
Thanks.