Advertisement

01.27.2008 at 09:23AM PST, ID: 23114719
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Failed to load report error message using crystal report .net and c# 2005

Hi,

I have the following code that opens a crystal report and displays it in the viewer on the winform: -

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;

namespace Slimming
{
    public partial class frmProgressReport : Form
    {
        protected CrystalDecisions.CrystalReports.Engine.ReportDocument reportDocument1;

        public frmProgressReport()
        {
            InitializeComponent();
        }

        private void frmProgressReport_Load(object sender, EventArgs e)
        {
            lblUser.Text = Program.frmMain.cmbUsers.Text;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            fraBuilding.Visible = true;
            dsMeasurements myDSMeasurements = new dsMeasurements();
            //Create connection to mdf sql file
            System.Data.SqlClient.SqlConnection con2 =
                new System.Data.SqlClient.SqlConnection(
                @"Data Source=.\sqlexpress;AttachDbFilename=|DataDirectory|\MainDB.mdf;Integrated Security=True;User Instance=True");

            //Create new data adapter and perform query
            System.Data.SqlClient.SqlDataAdapter da2 = new System.Data.SqlClient.SqlDataAdapter("SELECT     m.UserID, m.Weight, m.DateTaken, ISNULL(m.Weight - p.Weight, 0) AS 'Gain / Loss' FROM Measurements AS m LEFT OUTER JOIN Measurements AS p ON p.UserID = m.UserID AND p.DateTaken = (SELECT MAX(DateTaken) AS Expr1 FROM Measurements AS mm WHERE (DateTaken < m.DateTaken)) WHERE (m.UserID = '" + globalclass.userID.ToString() + "') ORDER BY m.DateTaken DESC", con2.ConnectionString);

            // place result into fixed dataset
            da2.Fill(myDSMeasurements, "dtMeasurements");

            String path = Environment.CurrentDirectory;

            //show crystal report and bind dataset to report
            ReportDocument rpt = new ReportDocument();
            rpt.Load(@"H:\crtest.rpt");
            rpt.SetDataSource(myDSMeasurements.Tables["dtMeasurements"]);
            crystalReportViewer1.ReportSource = rpt;


        }
    }
}

When I click button1 it comes up with the error message on the line rpt.Load(@"H:\crtest.rpt"); : -



System.Exception was unhandled
  Message="Load report failed."
  Source="CrystalDecisions.CrystalReports.Engine"
  StackTrace:
       at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob)
       at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename)
       at Slimming.frmProgressReport.button1_Click(Object sender, EventArgs e) in H:\Documents and Settings\Administrator\Desktop\Slimming3\frmProgressReport.cs:line 46
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at Slimming.Program.Main() in H:\Documents and Settings\Administrator\Desktop\Slimming3\Program.cs:line 24
       at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()



what am I doing wrong please.

Many Thanks
Lee
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: ljhodgett
Solution Provided By: mlmcc
Participating Experts: 2
Solution Grade: A
Views: 93
Translate:
Loading Advertisement...
01.27.2008 at 10:57AM PST, ID: 20754651

Rank: Wizard

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.27.2008 at 12:11PM PST, ID: 20754950

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.27.2008 at 05:30PM PST, ID: 20756190

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.27.2008 at 10:34PM PST, ID: 20757199

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.28.2008 at 06:02AM PST, ID: 20758901

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.28.2008 at 07:33AM PST, ID: 20759808

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080236-EE-VQP-29 / EE_QW_2_20070628