Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Crystal Reports Disable Login Prompt

I've developed an ASP.NET application with a Crystal Reports viewer. I used VS 2008, Crystal 2008, connecting to a SQL 2005 database. I used a System DSN ODBC to connect to SQL in the Crystal Report. My report works fine, both on my development machine and on the Web Server if the Save Data with Report is checked. My issue is that once I uncheck the 'Save Data with Report' option, I get prompted for a database login running the report off of the web server. I haven't seen anything definitive for an answer while searching the forums.

I've tried to create an odbc connection and use 'Trusted Connection', and re-map my DataSource, but that did not work. I also unchecked the EnableDatabaseLoginPrompt on the Report Viewer in VS.NET, no luck there either. What else can I try?

replied

I opened up a support case and I got my question answered. Here's what you need to do to get your asp.net application working.

In the Page_Load sub in the website.aspx.vb code, add this code in:

Imports CrystalDecisions.Shared

Imports CrystalDecisions.CrystalReports.Engine

Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()

Dim myReport As New ReportDocument()

myReport.Load(Server.MapPath("ReportName")) 'name of your Crystal Report - see note below

Dim myTables As Tables = myReport.Database.Tables

For Each myTable As CrystalDecisions.CrystalReports.Engine.Table In myTables

Dim myTableLogonInfo As TableLogOnInfo = myTable.LogOnInfo

myConnectionInfo.ServerName = <SQL servername>

myConnectionInfo.DatabaseName = "" 'leave database name blank

myConnectionInfo.UserID = 'login name

myConnectionInfo.Password = 'password

myTableLogonInfo.ConnectionInfo = myConnectionInfo

myTable.ApplyLogOnInfo(myTableLogonInfo)

Next

CrystalReportViewer1.ReportSource = myReport

A couple of more things:

Add your Crystal Report as an existing item directly to your project. This will push the report out with your webpage to the web server once you publish your application.

Only add the Crystal Report Viewer to your application.aspx page. Leave the Report Source blank. The code above will set your report source.

Hope this can help out someone else in the future!

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question