Print Page | Close Window

Call CrystalReport.rpt

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Writing Code
Forum Discription: .NET programming API, report integration
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=4024
Printed Date: 04 May 2024 at 10:40am


Topic: Call CrystalReport.rpt
Posted By: thinaz
Subject: Call CrystalReport.rpt
Date Posted: 19 Aug 2008 at 2:22am
I made a CrystalReport.rpt
I build an aspx file which consist of one button and one CrystalReportViewer.

how is the way to call the .rpt to the CrystalReportViewer???
and how is the connection to the database without wizard??
I've made this:

public partial class Default2 : System.Web.UI.Page
{
    private CrystalReport report = new CrystalReport();
    protected void Page_Load(object sender, EventArgs e)
    {
        CrystalReportViewer1.ReportSource = report;
        CrystalReportViewer1.Visible = true;
    }

    protected void  Button1_Click(object sender, EventArgs e)
    {
        MemoryStream oStream;
        oStream = (MemoryStream)report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
        Response.Clear();
        Response.Buffer = true;
        Response.ContentType="application/pdf";
        Response.BinaryWrite(oStream.ToArray());
        Response.End();
    }
}

but CrystalReport(bold) is not recognized..
mmm.. what is wrong woth my code??
is there any body can help me???



Replies:
Posted By: hilfy
Date Posted: 26 Aug 2008 at 2:13pm
There is no such class as "CrystalReport", unless it is a class in your application.  If it is, you need to check the namespace to make sure that the viewer and the report have the same namespace. 
 
-Dell


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window