Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: RE: Logon Error in Crystal Reports (using SQL Server) in A SP.NET


Message #1 by tom.ashley@u... on Wed, 12 Feb 2003 09:38:44
what do i need to code to change the line:
oRpt.Load("C:\inetpub\wwwroot\cag\reports\" + strReportFileName)
to allow me to load a report created on a server???

Tom




> You need to logon on server Try this, 

		In your code 
Imports CrystalDecisions.CrystalReports.Engine
    Dim oRpt As New ReportDocument
        oRpt.Load("C:\inetpub\wwwroot\cag\reports\" + strReportFileName)
        LogOn()
		CrystalReportViewer1.DataSource=oRpt
		CrystalReportViewer1.Bind()
   Private Sub LogOn()
		'for 
        Dim crLogonInfo As CrystalDecisions.Shared.TableLogOnInfo
        crLogonInfo = oRpt.Database.Tables(0).LogOnInfo
        crLogonInfo.ConnectionInfo.ServerName = "server name"
        crLogonInfo.ConnectionInfo.UserID = "userid"
        crLogonInfo.ConnectionInfo.Password = "password"
        crLogonInfo.ConnectionInfo.DatabaseName = "database"
        oRpt.Database.Tables(0).ApplyLogOnInfo(crLogonInfo)
    End Sub
I hope it will help

-----Original Message-----
From: Michael Piehota [mailto:mpiehota@r...] 
Sent: Thursday, April 25, 2002 2:03 AM
To: ASP+
Subject: [aspx] Logon Error in Crystal Reports (using SQL Server) in 
ASP.NET

I'm trying to use the CrystalReportViewer control on an ASP.NET page to 
display an simple report based on data extracted from SQL Server 2000.  I 
can successfully create the report by working through the Crystal Reports 
wizard.  The wizard accepts my connection information and shows me the 
contents of my database.  I can then pick and choose the data I want to 
show up on my report accordingly.  I places a CrystalReportViewer control 
on an ASP.NET page (language is C#) and went on to databind the 
ReportSource property to my report (for 
example, "c:\\inetpub\\wwwroot\\project\\CrystalReport1.rpt").  When I 
try to view the ASP.NET page in the browser, I consistently get the 
following error: CrystalDecisions.CrystalReports.Engine.LogOnException: 
Logon failed.

As an aside, the Crystal Reports example that ships with Microsoft.NET is 
based on data stored in a Microsoft Access database.  I can get this 
example to display correctly using the CrystalReportViewer control on an 
ASP.NET page.

Any help would be greatly apprecated.  

Thanks,
Mike P.

  Return to Index