Now I am tring to call reports in crystal reports server by asp.net. My server is crystal reports server xi, and for develop I also installed crystal report server client-side part on my develop machine, and crystal reports xi designer xi,r2.
My program is to call the rpt files on server and show them by CrystalReportViewer control, however I get the error message below:
Parser Error Message: The base class includes the field 'CRViewer', but its type (CrystalDecisions.Web.CrystalReportViewer) is not compatible with the type of control (CrystalDecisions.Web.CrystalReportViewer).
Source Error:
Line 10: <form id="form1" runat="server">
Line 11: <div>
Line 12: <CR:CrystalReportViewer ID="CRViewer" runat="server" AutoDataBind="true" />
Line 13: </div>
Line 14: </form>
My code is:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="CRSTest._Default" %>
<%@ Register assembly="CrystalDecisions.Web, Version=11.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" namespace="CrystalDecisions.Web" tagprefix="CR" %>
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<CR:CrystalReportViewer ID="CRViewer" runat="server" AutoDataBind="true" />
</div>
</form>
</body>
</html>
code behind:
ReportDocument rd = new ReportDocument();
string sampleReportName = "MyTest";
SessionMgr sessionMgr = new SessionMgr();
EnterpriseSession enterpriseSession;
EnterpriseService enterpriseService;
InfoStore infoStore;
InfoObjects infoObjects;
InfoObject infoObject;
ReportAppFactory reportAppFactory;
// Logon to an Enterprise session.
enterpriseSession = sessionMgr.Logon("Administrator", "1Qaz2wsx", "MOSSDEV-COYD:6400", "secEnterprise");
// Query for the sample report from the Enterprise CMS.
enterpriseService = enterpriseSession.GetService("InfoStore");
infoStore = new InfoStore(enterpriseService);
infoObjects = infoStore.Query("Select SI_CUID From CI_INFOOBJECTS Where SI_NAME='" + sampleReportName + "' And SI_INSTANCE=0");
infoObject = infoObjects[1];
string reportCUID = infoObject.CUID;
rd.EnterpriseSession = enterpriseSession;
rd.FileName = "cecuid:///" + reportCUID;
rd.SetDatabaseLogon("sqluser", "123456", "172.31.69.90", "AVIS_FMIS");
CRViewer.ReportSource = rd;
I check my assembly folder, I found three CrystalDecisions.Web dlls with different version, 11.5.3700.0, 11.5.3300.0, 10.5.3700.0, I try to refer to 11.5.3700.0 it says there is two CrystalDecisions.Web ddls exist in GAC.
Could you tell why? and how to refer to the right dll?
Thanks in advance