Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Report for .net - Passing LogIn credetials

Status
Not open for further replies.

newmem

Programmer
Jul 23, 2002
35
US
Hi everyone,

We are using Crystal Reports for .net in our web app. At design time, the connection is defined in the report using the OLE DB provider for SQL Server.

The issue occurs in the code-behind of the webfor1.aspx, while passing the LogOn information to the Crystal Report Document object. VS.net hoighlights and shows error msg at the line
crDatabase = crReportDocument.Database
The code is:
===================================================

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.IO

Public Class report_test
Inherits System.Web.UI.Page
Protected WithEvents crRptViewer As CrystalDecisions.Web.CrystalReportViewer

'CR Variables
Dim crReportDocument As report_test
Dim crTableLogOnInfo As TableLogOnInfo
Dim crConnectionInfo As ConnectionInfo
Dim crDatabase As Database
Dim crTables As Tables
Dim crTable As Table

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()

'Create an instance of the strongly-typed report object
crReportDocument = New report_test()

crConnectionInfo = New ConnectionInfo()
With crConnectionInfo
.ServerName = &quot;DEVSERVER1\DEVSERVER1&quot; 'physical server name
.DatabaseName = &quot;pubs&quot;
.UserID = &quot;sa&quot;
.Password = &quot;mypwd&quot;
End With


crDatabase = crReportDocument.Database
crTables = crDatabase.Tables

For Each crTable In crTables
crTableLogOnInfo = crTable.LogOnInfo
crTableLogOnInfo.ConnectionInfo = crConnectionInfo
crTable.ApplyLogOnInfo(crTableLogOnInfo)
Next

'Set the viewer to the report object to be previewed.
crRptViewer.ReportSource = crReportDocument

End Sub
================================================

Am I missing something in the code? Any help is appreciated.

Thanks in advance.
 
What is the error message you are receiving?

Stephen Barrett
Systems Architect
Aon Consulting, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top