Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Logon Error in Crystal Reports (using SQL Server) in ASP.NET


Message #1 by "Michael Piehota" <mpiehota@r...> on Thu, 25 Apr 2002 07:02:43
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.
Message #2 by "Brzeski, Tom" <Tom.Brzeski@o...> on Thu, 25 Apr 2002 09:29:36 -0400
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.
Message #3 by "Brzeski, Tom" <Tom.Brzeski@o...> on Thu, 25 Apr 2002 09:35:35 -0400
Correction line
		CrystalReportViewer1.DataSource=oRpt
		CrystalReportViewer1.Bind()        
Should be
		CrystalReportViewer1.ReportSource=oRpt
        	CrystalReportViewer1.DataBind()

-----Original Message-----
From: Brzeski, Tom 
Sent: Thursday, April 25, 2002 8:30 AM
To: ASP+
Subject: [aspx] RE: Logon Error in Crystal Reports (using SQL Server) in A
SP.NET

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