Hi All
I got an error while working with Crystal reports
I have added a crystal report and set a command over there to get data.
I have added a crystalreportviewer named CRV to my web form and the code given as

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace Cryppp
{
	/// <summary>
	/// Summary description for WebForm1.
	/// </summary>
	public class WebForm1 : System.Web.UI.Page
	{
		protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer1;
		protected CrystalDecisions.Web.CrystalReportViewer CRV;
			Sample sr=new Sample();
		private void Page_Load(object sender, System.EventArgs e)
		{
			// Put user code to initialize the page here
			sr.SetDatabaseLogon("sa", "", "as34", "pubs");
			sr.Load();
				CRV.ReportSource=sr;
			DataBind();
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{    
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion
	}
}

the error was

Server Error in '/Cryppp' Application.
--------------------------------------------------------------------------------

Load report failed. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: CrystalDecisions.CrystalReports.Engine.LoadSaveReportException: Load report failed.

Source Error: 


Line 23: 		{
Line 24: 			// Put user code to initialize the page here
Line 25: 			sr.SetDatabaseLogon("sa", "", "as34", "pubs");
Line 26: 			sr.Load();
Line 27: 				CRV.ReportSource=sr;
 

Source File: c:\inetpub\wwwroot\cryppp\webform1.aspx.cs    Line: 25 

Stack Trace: 


[LoadSaveReportException: Load report failed.]
   .F(String 	, EngineExceptionErrorID 
)
   .B(String , Int32 )
   CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String reportName, OpenReportMethod openMethod, Int16 parentJob)
   CrystalDecisions.CrystalReports.Engine.ReportClass.Load(String reportName, OpenReportMethod openMethod, Int16 parentJob)
   CrystalDecisions.CrystalReports.Engine.ReportDocument.'()
   CrystalDecisions.CrystalReports.Engine.ReportDocument.get_Database()
   CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDatabaseLogon(String user, String password, String server, String database)
   Cryppp.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\cryppp\webform1.aspx.cs:25
   System.Web.UI.Control.OnLoad(EventArgs e)
   System.Web.UI.Control.LoadRecursive()
   System.Web.UI.Page.ProcessRequestMain()

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032

Help me
Thanks in advance...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.