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
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.SetDatabaseLogon("LocalAccount", "passsword", @"SQLData", "Database1");
CrystalReportViewer1.ReportSource = CrystalReport;
}
}
}
What did I do wrong?