View Single Post
  #1 (permalink)  
Old February 19th, 2004, 10:13 PM
chinhow chinhow is offline
Authorized User
 
Join Date: Feb 2004
Location: , , .
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default asp.net Crystal Report

hi, I'm a newbie of asp.net developer, and I have face a problem when creating a asp.net crystal report. The way i created the crystal report is same as i created in VB.NET windows desktop application. But it seemed doesn't work in ASP.NET. When the Page_Load() executed, there is an error message shown as "An object is not set as an instance of an object". I know the code is slightly different between asp.net and vb.net when creating the crystal report.

My environment as below:
1. using Microsoft visual studio.net 2002
2. Database, MS Access 2000
3. WinXP professional (OS)
4. Code below is from the web form

I hope there is someone can provide me some complete example or provide me some guidelines of how to develop crystal report in asp.net if you are experienced in this issue.

Thanks and hope can hear from you all soon.

Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'Put user code to initialize the page here
        Dim aPrintMonthlyPC As New ReportDocument()

        PrintMonthlyPCAdapter1.SelectCommand.CommandText = _
        "SELECT * FROM Employee "
        PrintMonthlyPCAdapter1.Fill(DsPrintMonthlyPC1)

        Try
           Dim aPrintMonthlyPC As ReportPrintMonthlyPC
           aPrintMonthlyPC = New ReportPrintMonthlyPC()
           aPrintMonthlyPC.SetDataSource(DsPrintMonthlyPC1)
           Me.PrintMonthlyPCViewer1.DisplayGroupTree = True


           Me.PrintMonthlyPCViewer1.ReportSource = aPrintMonthlyPC

        Catch ex As Exception
           MsgBox("Exception")
        End Try
    End Sub