数据库登录失败 [英] Database Logon Failed

查看:74
本文介绍了数据库登录失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网页表单,上面有一个Crystal Report Viewer。当在开发计算机上单击打印按钮时,网页显示报告,一切正常并且看起来很好。当我把它放在服务器上,带有IIS 8的Windows Server 2012,然后点击打印按钮,网页出现错误说:



I have a web form that has a Crystal Report Viewer on it. When the print button is clicked on the development computer the web page displays the report and everything works and looks good. When I put it on the sever, Windows Server 2012 with IIS 8, and click the print button the web page comes up with an error saying:

Failed to open the connection. Failed to open the connection. FormAReport {4227EE7A-30FE-48B6-A305-2A2F887E857C}.rpt





报告按会话加载。会话按用户ID号进行。我知道该报告适用于开发计算机,但为什么它不适用于服务器?



我使用CR 2013进行报告。我还使用了Report,Select Expert,Record。在其中我使用了这个公式:{TableCOCINST.INST_ID} = {?inst_id}。



以下是要在CRV中加载的报告的代码:





The report loads by a session. The session goes by the users ID number. I know the report works on the development computer but why doesn't it work for the server?

I used CR 2013 to make the report. I also used the Report, Select Expert, Record. Within that I used this formula: {TableCOCINST.INST_ID} = {?inst_id}.

Here is the code for the report to load in CRV:

using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using CrystalDecisions.Web;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.WebControls;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.Windows.Forms;
using CrystalDecisions.ReportSource;
using CrystalDecisions.ReportAppServer;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Xml.Linq;
using System.Web.SessionState;

namespace SACSCOCLogin1._1
{
    public partial class ReportFormFTE : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            TextBoxINST_ID.Text = Session["inst_id"].ToString();
            CrystalReportViewer1.Visible = true;

            ReportDocument CrystalReport = new ReportDocument();
            ParameterField paramField = new ParameterField();
            ParameterFields paramFields = new ParameterFields();
            ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();

            paramField.Name = "inst_id";
            paramField.CurrentValues.Clear();
            paramDiscreteValue = new ParameterDiscreteValue();
            paramDiscreteValue.Value = TextBoxINST_ID.Text;
            paramFields.Add(paramField);
            CrystalReportViewer1.ParameterFieldInfo = paramFields;

            CrystalReport.Load(Server.MapPath("FormFTEReport.rpt"));
            string sessiontype = TextBoxINST_ID.Text;
            CrystalReport.SetParameterValue("inst_id", TextBoxINST_ID.Text);

            string sessionid = TextBoxINST_ID.Text;
            CrystalReport.SetParameterValue("inst_id", TextBoxINST_ID.Text);
            //CrystalReport.Refresh();
            CrystalReport.SetDatabaseLogon("LocalAccount", "passsword", @"SQLData", "Database1");
            CrystalReportViewer1.ReportSource = CrystalReport;
        }
    }
}





我做错了什么?



What did I do wrong?

推荐答案

这篇关于数据库登录失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆