ARTICLE

RptPreview 1.1 using Crystal Reports Viewer

Posted by Ilya Feigin Articles | Visual Basic 2010 June 10, 2003
The following small application is designed to allow testing created reports with XML feeds used as data sources. The program checks that fields in report match to the fields in XML and then shows the report with loaded data in the report viewer.
Download Files:
 
Reader Level:

Purpose

The following small application is designed to allow testing created reports with XML feeds used as data sources. The program checks that fields in report match to the fields in XML and then shows the report with loaded data in the report viewer.

How to Use?

1. Fill the following fields "Path to Report" and "Path to XML file": The "Path to Report textbox" serves for entering the path to a report. (Ex: CROrdersManifest.rpt).

The "Path to XML file" allows entering the path to the XML feed. (ex: XMLOrdersManifest.xml).

Both files are stored in the root of the application.

Note: Browse buttons open a standard File Open dialog.

2. Click Preview Report

Note: The program checks that specified report and XML match to each other- i.e. they contain the same fields. If the program finds inconsistence it reports about it as it is shown below:

Advice

In order to get XML file use WriteXml method of dataset class. Like the following:

OrderDataSet.WriteXml("C:\Inetpub\wwwroot\UniversalTicketSystem\Docs\USPS.xml").

Having created XML file you can allow designers to create reports without permanent access to your database.

Implementation details

'initializing
Dim dtsData As New DataSet
Dim oRpt As New ReportDocument
'try to load the specified report file
oRpt.Load(Me.txtReportPath.Text, OpenReportMethod.OpenReportByTempCopy)
'try to load data for the report
dtsData.ReadXml(Me.txtXMLPath.Text)
Dim missingInSource, missingInReport As String
'checks that fields in XML file match to the fields specified in the report file
Dim fieldsMissing As Boolean = Not CheckMissingFields(oRpt, dtsData, missingInSource, missingInReport)
'informs about the result of checking
ShowMissingFields(missingInSource, missingInReport)
If Not fieldsMissing Then
oRpt.SetDataSource(dtsData)
cRVOrder.ReportSource = oRpt
End If

share this article :
post comment
 

Hi

This is kamal...I'm software Engineer...I have one problem in crystal report....

Question:I have some reports these are designed in crystal report version 9.I want to convert these into .Net.So i was opened these report into .net2005,but these were not opened.Why?And tell some tips to open these report....

Help me..

Kamal....

Posted by kamal kannan Dec 27, 2006
Nevron Diagram
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Become a Sponsor