CrystalDecisions.CrystalReports.Engine.InternalExc
Hi Guys,
I am trying to generate a PDF file off a crystal report, when I run my web service via the code(by pressing F5" ) works fine, and the pdf gets generated, however once I publish and consule it using a client ASP.net page I get the following error
ERROR:
CrystalDecisions.CrystalReports.Engine.InternalExc eption: Failed to open a rowset.
Details: ADO Error Code: 0x
Source: Microsoft OLE DB Provider for SQL Server
Description: Login failed for user ''. The user is not associated with a trusted SQL Server connection.
SQL State: 42000
Native Error:
Failed to open a rowset.
my code is listed below
ReportComData oRepData = new ReportComData();
oRepData.getReportID = szReportID;
//getRepComData(oRepData);
string szReportFileName = "Products.rpt"; //oRepData.getszRptFileName; //"OutbreakPredictReport.rpt";
string szFileName = "REP" + DateTime.Now.ToString("ddMMyyyyhhmmss") + ".pdf";
//--Initializing CrystalReport
ReportDocument myReportDocument;
myReportDocument = new ReportDocument();
myReportDocument.Load(System.Web.HttpContext.Curre nt.Server.MapPath(szReportFileName));
//--------- new
// 'CrystalReport1' must be the name the CrystalReport
TableLogOnInfo crTableLogOnInfo = new TableLogOnInfo();
ConnectionInfo crConnectionInfo = new ConnectionInfo();
//Crystal Report Properties
CrystalDecisions.CrystalReports.Engine.Database crDatabase;
CrystalDecisions.CrystalReports.Engine.Tables crTables;
// CrystalDecisions.CrystalReports.Engine.Table crTable;
crConnectionInfo.ServerName = "bandicoot.cs.rmit.edu.au";
crConnectionInfo.Type = ConnectionInfoType.SQL;
crConnectionInfo.DatabaseName = "DPI";
crConnectionInfo.IntegratedSecurity=true;
crConnectionInfo.UserID = "RMITCS\\hkoidtuw";
crConnectionInfo.Password = "monday";
crDatabase = myReportDocument.Database;
crTables = crDatabase.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)
{
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
string strTableLoc = crTable.Location.Substring(crTable.Location.LastIn dexOf(".") + 1) ;
crTable.Location = crConnectionInfo.DatabaseName + ".dbo." + strTableLoc;
crTable.ApplyLogOnInfo(crTableLogOnInfo);
}
-----
myReportDocument.SetParameterValue(0, iFarmID);
myReportDocument.SetParameterValue(1, FromDate);
myReportDocument.SetParameterValue(2, toDate);
Your help is greatly appriciated
|