Home » VB.NetRSS

Load report failed

Hi ,

 

I m trying to create a report using Crystal Report with C# in WPF(Using Visual Studio 2008) . I have Sqlite DB and need to display record in a report. I used  following code.

 

 <Window x:Class="WpfApplication5.Window1"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Title="Crystl Report in WPF" WindowState="Maximized" Loaded="Window_Loaded">

    <Grid>

        <WindowsFormsHost Name="reportViewer">

 

        </WindowsFormsHost>

    </Grid>

</Window>

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Data;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Imaging;

using System.Windows.Shapes;

 

using CrystalDecisions.Windows.Forms;

using CrystalDecisions.CrystalReports.Engine;

 

namespace WpfApplication5

{

    ///<summary>

    /// Interaction logic for Window1.xaml

    ///</summary>

    publicpartialclassWindow1 : Window

    {

        CrystalReportViewer cryreportviewer = null;

        public Window1()

        {

            CrystalReportViewer cryreportviewer = null;

            InitializeComponent();

          

            // create new crystalReport viewer

            cryreportviewer = new CrystalReportViewer();

            cryreportviewer.DisplayGroupTree = false;

            // add crystl report view as child control  to windows forms host object.

            reportViewer.Child = cryreportviewer;

        }

        privatevoid Window_Loaded(object sender, RoutedEventArgs e)

        {

            if (reportViewer == null)

            {

                cryreportviewer = new CrystalReportViewer();

                reportViewer.Child = cryreportviewer;

 

            }

            // create new report document

            ReportDocument report = newReportDocument();

            // load report to document

            report.Load("CrystalReport1.rpt");

            cryreportviewer.ReportSource = report;

 

        }

    }

}

 

When I run this I m getting following error .

 

An unhandled exception of type 'CrystalDecisions.Shared.CrystalReportsException' occurred in CrystalDecisions.CrystalReports.Engine.dll

 

Additional information: Load report failed.

 

Can Anybody Please help me to solve this error.

 

Thanks.

 

3 Answers Found

 

Answer 1

Hi,

So, is your Crystal report  Viewer hosted correctly?

If so, then how about adding a OpenReportMethod?

report.load("you file.rpt", OpenReportMethod.___)..?

 

hope this helps.

 

Regards,

gioVhan

 

Answer 2

Hi gioVhan,

Actually i'm really new to these stuffs and dont know how to do Crystal report  Viewer host. I just create  a crystal  report and used above code, thats all. I would appreciate verymuch if you can send me some, sample code or and good link I can reffer.

Thanks.

 
 
 
Search for  Load report failed
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter