我試圖以PDF格式打印水晶報表,並且在我的本地機器上工作正常。但是,當我將應用程序發佈到服務器時,它在「打印」按鈕上給我出現以下錯誤。 我正在使用VS2012,SQl Server 2012,IIS 7.5和CR版本13.5 注意:我正在使用集成安全性,因此我將用戶名和密碼留空。請幫忙。 我的代碼行:Crystal Reports:數據庫登錄失敗
string Constring1 = ConfigurationManager.ConnectionStrings["dbRMCConnectionString"].ConnectionString;
SqlConnection conn = new SqlConnection(Constring1);
conn.Open();
ReportDocument rpt = new ReportDocument();
rpt.Load(Server.MapPath("RMCChallan.rpt"));
ParameterFieldDefinitions crParameterFieldDefinations;
ParameterFieldDefinition crParameterFieldDefination;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterValues.Clear();
crParameterDiscreteValue.Value = lbl_Cno.Text;
crParameterFieldDefinations = rpt.DataDefinition.ParameterFields;
crParameterFieldDefination = crParameterFieldDefinations[0];
crParameterValues = crParameterFieldDefination.CurrentValues;
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefination.ApplyCurrentValues(crParameterValues);
rpt.SetDatabaseLogon("", "", "ADMIN-PC\\ADMIN", "dbRMC");
rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, Guid.NewGuid().ToString());
感謝您的幫助提前! :)
堆棧跟蹤: 我想打印PDF格式的水晶報告,並在我的本地機器上工作正常。但是,當我將應用程序發佈到服務器時,它在「打印」按鈕上給我出現以下錯誤。 我正在使用VS2012,SQl Server 2012,IIS 7.5和CR版本13.5 注意:使用Windows身份驗證..沒有用戶名和密碼分配給我的數據庫。 '/'應用程序中的服務器錯誤。
數據庫登錄失敗。
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
異常詳細信息:System.Runtime.InteropServices.COMException: Database logon failed.
源錯誤:
Line 178: crParameterFieldDefination.ApplyCurrentValues(crParameterValues);
Line 179: rpt.SetDatabaseLogon("", "", "ADMIN-C\\ADMIN","MyDatabase");
Line 180: rpt.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, Guid.NewGuid().ToString());
Line 181:
Line 182:
源文件:e:\25jan14\WebSite1\RMC.aspx.cs Line: 180
堆棧跟蹤:
[COMException (0x8004100f): Database logon failed.]
CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext) +0
CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) +257
[LogOnException: Database logon failed.]
CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e) +332
CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext) +310
CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext) +654
CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportOptions options) +92
CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToHttpResponse(ExportOptions options, HttpResponse response, Boolean asAttachment, String attachmentName) +96
CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToHttpResponse(ExportFormatType formatType, HttpResponse response, Boolean asAttachment, String attachmentName) +119
RMC.Button5_Click(Object sender, EventArgs e) in e:\25jan14\WebSite1\RMC.aspx.cs:180
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9553594
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +103
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724