Crystal Report and Inline code

G

Guest

I'm trying to develop a crystal report page using inline code (no code behind
page).

Here is my code:

<%@ Page language="c#" %>
<%@ Register TagPrefix="cr" Namespace="CrystalDecisions.Web"
Assembly="CrystalDecisions.Web, Version=9.1.5000.0, Culture=neutral,
PublicKeyToken=652fbea5521e1541" %>

<HTML>
<HEAD>
<script language=CS runat=server>
private void Page_Load(object sender, System.EventArgs e)
{
CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer1 = new
CrystalDecisions.Web.CrystalReportViewer();
crystal.Simple sreport = new Simple();
CrystalReportViewer1.ReportSource = sreport;
sreport.SetDatabaseLogon("Duncan","password");
}
</script>
<title>WebForm2</title>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server"><CR:CrystalReportViewer
id=CrystalReportViewer1 style="Z-INDEX: 101; LEFT: 6px; POSITION: absolute;
TOP: 5px" runat="server"></CR:CrystalReportViewer>
</form>
</body>
</HTML>

I'm not sure how to reference the namespaces, on a code behind page its:
using CrystalDecisions.Shared;
using System.Data.SqlClient;

I'm getting the following error: CS0246: The type or namespace name 'Simple'
could not be found (are you missing a using directive or an assembly
reference?)

Also I'm not sure how to instantiate the viewer, on a code behind page its:
protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer1;
Where would I put this on the inline page?

Thanks for any help,

John
 
G

Guest

Hi John,

It seems that crystal.Simple is strong type of

CrystalDecisions.CrystalReports.Engine.ReportDocument

You might also need namespace CrystalDecisions.ReportSource.

HTH

Elton Wang
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top