locked
C# Crystal Reports Aspx RRS feed

  • Question

  • I have a Crystal Report that works, and I am trying to integrate it into VS.  I have created an aspx and code behind.  For some reason it doesn't run, but I can't figure out what I did wrong.  Below is the code from both files, with passwords, etc., redacted.

    // CrystalReports.aspx

    <%@ Page Title="" Language="C#" MasterPageFile="~/CommonCode/CommonPages/RMIS.master"
        AutoEventWireup="True" Trace="false" Inherits="CrystalReports" CodeBehind="CrystalReports.aspx.cs" %>

    <%@ Register Assembly="System.Web.DynamicData, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        Namespace="System.Web.DynamicData" TagPrefix="cc2" %>

    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
    <%@ Register Assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" Namespace="CrystalDecisions.Web" TagPrefix="CR" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="headContentPlaceHolder" runat="Server">
    </asp:Content>
    <asp:Content ID="Content" ContentPlaceHolderID="MainContentPlaceHolder" runat="Server">
        <form id="form1" runat="server">
            <CR:CrystalReportViewer ID="CrystalReportViewer" runat="server" AutoDataBind="false" />
        </form>
    </asp:Content>

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using RAPPDAL;
    using RAPPBLL;
    using RAPPServices;
    using RMISBLL;
    using LogLibrary;
    using RMISDAL;
    using CrystalDecisions.CrystalReports.Engine;
    using CrystalDecisions.Shared;
    using CrystalDecisions.Windows.Forms;

    public partial class CrystalReports : RAPPBasePage
    {
            protected override void Page_Load(object sender, EventArgs e)
            {
                base.Page_Load(sender, e);
                master.statusBarIsVisible = false;
                InitializeReport();
            }

            private void InitializeReport()
            {
                ReportDocument crystalReport = new ReportDocument();
                ConnectionInfo crConnectionInfo = new ConnectionInfo();
                crystalReport.Load(Server.MapPath("~/01 CrossTab Summary of National Performance Measures.rpt"));
                crConnectionInfo.ServerName = "Server Name";
                crConnectionInfo.DatabaseName = "Database Name";
                crConnectionInfo.UserID = "User";
                crConnectionInfo.Password = "Password";
                CrystalReportViewer crystalReportViewer = new CrystalDecisions.Windows.Forms.CrystalReportViewer();
                crystalReportViewer.ReportSource = crystalReport;
                crystalReportViewer.Refresh();
            }
    }

    • Moved by Caillen Tuesday, October 1, 2013 2:43 AM
    Monday, September 30, 2013 1:53 PM

All replies

  • Hi AlanNegin,

    Please post your question in Crystal Reports forum for better responses. Microsoft don't provide support for this 3rd-party project.

    Thanks for your understanding.


    Caillen
    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Tuesday, October 1, 2013 2:43 AM