The test I ran worked fine (but not after a couple of days of
trouble-shooting). Below is my code... Let me know what caused your
problem...I also implemented an export to a PDF file (I think that's where
the power of crystal reports really is):
My aspx looks like this:
<%@ Register TagPrefix="cr" Namespace="CrystalDecisions.Web"
Assembly="CrystalDecisions.Web" %>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="CR1.aspx.vb"
Inherits="Membership.CR1"%>
<%@ Register TagPrefix="cr" Namespace="CrystalDecisions.Web"
Assembly="CrystalDecisions.Web" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title></title>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body >
<form id="Form1" method="post" runat="server">
<P>
<TABLE cellSpacing=0 cellPadding=0 width="95%" align=center border=0>
<TR>
<TD>
<cr:CrystalReportViewer
id=CrystalReportViewer1
runat="server" Width="700px" Height="940px" BorderColor="SteelBlue"
BorderStyle="Solid" BorderWidth="1px" DisplayGroupTree="False"
PageZoomFactor="85" BestFitPage="False"
></cr:CrystalReportViewer></TD></TR></TABLE></P>
<P> </P>
</form>
</body>
</HTML>
-----------------------------------------------------------------------
the behind code is:
Public Class CR1
Inherits System.Web.UI.Page
Protected WithEvents SqlConnection1 As
System.Data.SqlClient.SqlConnection
Protected WithEvents CrystalReportViewer1 As
CrystalDecisions.Web.CrystalReportViewer
Protected WithEvents SqlDataAdapter1 As
System.Data.SqlClient.SqlDataAdapter
Protected WithEvents SqlSelectCommand1 As
System.Data.SqlClient.SqlCommand
Public objReport As New CrystalReport1()
Protected WithEvents Report11 As Membership.Report1 'this is my dataset
object
'needed for pdf export
Protected crExportReport As New CrystalReport1()
Protected crExportOptions As CrystalDecisions.Shared.ExportOptions
Protected crDestOptions As New
CrystalDecisions.Shared.DiskFileDestinationOptions()
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
Dim MyDate As New Date()
Dim MyStr As String
Try
MyDate = Request.QueryString("From")
SqlDataAdapter1.SelectCommand.Parameters("@GroupID").Value
Request.QueryString("Group")
SqlDataAdapter1.SelectCommand.Parameters("@From").Value
MyDate.ToShortDateString
MyDate = Request.QueryString("To")
SqlDataAdapter1.SelectCommand.Parameters("@To").Value
MyDate.ToShortDateString
SqlDataAdapter1.Fill(Report11, "SG_Report1")
Catch ex As Exception
MyStr = ex.Message
End Try
objReport.SetDataSource(Report11)
CrystalReportViewer1.ReportSource = objReport
'my export file
crExportReport = objReport
MyStr = Server.MapPath("../private/mytest.pdf")
crDestOptions.DiskFileName = MyStr
crExportOptions = crExportReport.ExportOptions
crExportOptions.ExportDestinationType
CrystalDecisions.[Shared].ExportDestinationType.DiskFile
crExportOptions.ExportFormatType
CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat
crExportOptions.DestinationOptions = crDestOptions
Try
crExportReport.Export()
Catch Err As Exception
Response.Write(Err.ToString)
End Try
End Sub
-----Original Message-----
From: tvoss@c...
[mailto:tvoss@c...]
Sent: Sunday, December 16, 2001 4:57 AM
To: ASPX_Professional
Subject: [aspx_professional] RE: crystal report bound to dataset
Octavio,
I added the data control for dataset1 and named it objDataset and removed
my line for the public objDataset so that protected with events line
replaced it. No change in behaviour. Do you know if anyone here has gotten
the dataset binding walkthrough to work? Maybe I should do the exact
sample with the MS Access table first.
Thanks,
> OK... Let's try something else:
> I added the dataset using the design window, so the data set is declared
> PROTECTED WITHEVENTS.
>
> Let me know if it works...
>
> Octavio
>
$subst('Email.Unsub').