Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
|
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 16th, 2005, 05:31 AM
Registered User
 
Join Date: Aug 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default VB 2005 crystal problem

I have the following function in my app (2005) that should be loading a form
and populating a crystal report contained by a crystal report viewer.

I have an almost identical piece of code in another app (.Net) which works
fine, however when this report is displayed it contains no data. Can't
really see why. Can anyone help?

Public Function PrintReports(ByVal strSQL As String, ByVal strSelect As
String, ByVal strReportName As String, ByVal strXSDName As String) As
Integer

Try

Dim myRptString As String = strReportRoot & strReportName

Dim myXsdTable As String = strXSDName

Dim oleConn As New System.Data.OleDb.OleDbConnection(strConnADO)

Dim oleAdapter As New System.Data.OleDb.OleDbDataAdapter()

Dim myDataset As New DataSet()

Dim myReport As New CrystalReport1

Dim myForm As New frmCrystalViewer

Dim objClass As New clsSQL

If objClass.RunPassedSQL("Delete From SubscriptionsPrintQueue") = False Then
GoTo CatchError ' Deletes data records in table

If objClass.RunPassedSQL(strSQL) = False Then GoTo CatchError ' Populates
data in table

objClass = Nothing

oleAdapter.SelectCommand = New System.Data.OleDb.OleDbCommand(strSelect,
oleConn)

' Connect to the data source, fetch the data, and disconnect from the
database.

oleAdapter.Fill(myDataset, myXsdTable)

MessageBox.Show(myDataset.Tables(0).Rows.Count) ' Shows over 35k records

With myReport

.SetDataSource(myDataset)

.Refresh()

MessageBox.Show(.Rows.Count) ' Shows 0 records

End With

With myForm

.CrystalReportViewer1.ReportSource = myReport

.CrystalReportViewer1.DisplayGroupTree = False

.CrystalReportViewer1.Refresh()

.CrystalReportViewer1.RefreshReport()

.CrystalReportViewer1.Visible = True

.Show()

End With

Catch objE As Exception

MessageBox.Show(objE.Message & vbCrLf & vbCrLf & "Please contact your IT
department.", "Error encountered ==> clsCrystal:PrintReports",
MessageBoxButtons.OK, MessageBoxIcon.Error)

GoTo catcherror

End Try

TheExit:

Exit Function

CatchError:

GoTo TheExit

End Function








Similar Threads
Thread Thread Starter Forum Replies Last Post
Deploye crystal report with VB.NET 2005 zrtv Crystal Reports 2 June 6th, 2009 08:09 AM
VB 2005 Crystal Report Connection with SQL 2000 blackspear BOOK: Professional Crystal Reports for VS.NET 0 December 3rd, 2008 09:49 AM
Using Crystal in VB 2005 without Report Viewer csdunaway Crystal Reports 6 July 18th, 2007 11:48 AM
Export Crystal 8.5 using VB 2005 mahegazy Pro Visual Basic 2005 0 March 23rd, 2006 03:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.