Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Re: Crystal Reports, anyone?


Message #1 by "Rakesh" <patelra_72@h...> on Thu, 23 May 2002 22:45:37
reference a new ReportDocument in code then assign the strong typed 
docuemnt a dataset this bypasses login information such as this.. the 
bypass uses the dataset login information instead.

using CrystalDecisions.CrystalReports.Engine;


private ReportDocument rep;

void TimeCards()
{
   rep = new timecard();   //report you created...
   rep.SetDataSource(ds);  //filled dataset of information u want on
                           //report only...

   viewer.ReportSource = rep;
}


Morgan Vermef 



> 
Rakesh,

I talked to a very helpful tech rep at Crystal, and we got the following 
code to work...

HTH,
Lynn


// need these namespaces...

using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.ReportSource;
using CrystalDecisions.Shared;

// in the page load event... 

	private void Page_Load(object sender, System.EventArgs e)
	{
		CrystalDecisions.Shared.TableLogOnInfo MyTableLogOnInfo;
		ConnectionInfo MyConnectionInfo;

		// create a ReportDocument and load the CR report file...
		ReportDocument MyReportDocument = new ReportDocument();
		MyReportDocument.Load
(@"d:\delta\TryCrystal\CrystalReport2.rpt");
		// set up connection information (the password isn't kept 
in the report file)...
		MyConnectionInfo = new ConnectionInfo();
		MyConnectionInfo.Password = "fireball";
		foreach (CrystalDecisions.CrystalReports.Engine.Table T 
in MyReportDocument.Database.Tables)
		{
			MyTableLogOnInfo = T.LogOnInfo;
			MyTableLogOnInfo.ConnectionInfo = 
MyConnectionInfo;
			T.ApplyLogOnInfo(MyTableLogOnInfo);
		}
		// set the viewer's report source...
		CrystalReportViewer1.ReportSource = MyReportDocument;
	}




> ----------
> From: 	Rakesh[SMTP:patelra_72@h...]
> Reply To: 	ASPX_Professional
> Sent: 	Thursday, May 23, 2002 5:45 PM
> To: 	ASPX_Professional
> Subject: 	[aspx_professional] Re: Crystal Reports, anyone?
> 
> did u find any solution to ur problem !! I wam having the same 
problem.. 
> 
> 
> T> rying my first Crystal Report in ASP.NET, I get the 
> e> rror "CrystalDecisions.CrystalReports.Engine.LogOnException: Logon 
> f> ailed" when trying to run it.  I know I used a valid user id and 
> password 
> t> o the (Oracle) database when designing the report, and I know I can 
> c> onnect to the DB with that user id and password through other ASP 
pages 
> I> 've developed.  I'm running this stuff only on my own development 
> m> achine.  I can't find any code exposed by the 'report object' to 
help 
> in 
> d> ebugging the situation.  Any suggestions?
> ---
> Change your mail options at http://p2p.wrox.com/manager.asp or 
> to unsubscribe send a blank email to 
> 

  Return to Index