数据库登录失败。
描述:执行期间发生了未处理的异常 当前的网络请求。请查看堆栈跟踪了解更多信息 有关错误的信息以及它在代码中的起源。
异常详细信息:System.Runtime.InteropServices.COMException: 数据库登录失败。
来源错误:
第31行:report.Load(Server.MapPath(“Purchases2.rpt”));线 32:report.SetParameterValue(“PurchDate”, DateTime.Parse(txtPurch.Text));第33行:
report.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, 回应,真实,第34行:“购买报告”);第35行:源文件:c:\ Users \ Isidro \ Desktop \ MRP \ Reports \ Purchases.aspx.cs
行:33堆栈追踪:
[COMException(0x8004100f):数据库登录失败。]
CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions,RequestContext pRequestContext)+0
CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)+414[LogOnException:数据库登录失败。]
CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(例外 e)+332
CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)+947
CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)+654
CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToStream(ExportOptions 选项)+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 Reports_Purchases.btnMaterials_Click(Object 发件人,EventArgs e)in C:\用户\圣伊西德罗\桌面\ MRP \报告\ Purchases.aspx.cs:33
System.Web.UI.WebControls.Button.OnClick(EventArgs e)+109
System.Web.UI.WebControls.Button.RaisePostBackEvent(字符串 eventArgument)+108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(字符串 eventArgument)+10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl,String eventArgument)+13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +31 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,Boolean includeStagesAfterAsyncPoint) 3466
后端代码:
void GetReport()
{
ReportDocument report = new ReportDocument();
report.Load(Server.MapPath("~/Reports/Purchases2.rpt"));
report.SetDatabaseLogon("sa", "benilde", @"MJ\ISIDRO", "MRPsys");
}
protected void btnMaterials_Click(object sender, EventArgs e)
{
ReportDocument report = new ReportDocument();
report.Load(Server.MapPath("Purchases2.rpt"));
report.SetParameterValue("PurchDate", DateTime.Parse(txtPurch.Text));
report.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, true,
"Purchases Report");
crvReport.ReportSource = report;
crvReport.DataBind();
}