Report Design
 Crystal Reports Forum : Crystal Reports .NET 2003 : Report Design
Message Icon Topic: Getting login prompt Post Reply Post New Topic
Author Message
techie3
Newbie
Newbie


Joined: 11 Jan 2007
Location: United States
Online Status: Offline
Posts: 18
Quote techie3 Replybullet Topic: Getting login prompt
    Posted: 19 Mar 2007 at 9:52am
I created a report with many subreports.  On my test environment the entire report runs fine.  On the development server, I am getting prompted for login.  How do I resolve it?
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 19 Mar 2007 at 12:00pm
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
techie3
Newbie
Newbie


Joined: 11 Jan 2007
Location: United States
Online Status: Offline
Posts: 18
Quote techie3 Replybullet Posted: 20 Mar 2007 at 8:55am

For some reason it didn't work.  Perhaps I didn't have it placed correctly. I have a lopp through each subreport and if there is a match for a specific subreport name then 'setdatasource'.  End of loop I set the viewer's reportsource.  I call a routine (setDbLogonForSubreports) to get the login info before the subreport loop.  But I am still getting prompted.

 

Sub SetDBLogonForSubreports()

Dim crConnectioninfo As ConnectionInfo

crConnectioninfo = New ConnectionInfo

Dim crTableLogOnInfo As TableLogOnInfo

Dim ServerName As String = "xxxxx"

Dim UserID As String = "xxxxxx"

Dim Password As String = "xxxxx"

Dim DatabaseName As String = "xxxxx"

'pass the necessary parameters to the connectionInfo object

With crConnectioninfo

.ServerName = ServerName

.UserID = UserID

.Password = Password

.DatabaseName = DatabaseName

End With

'set up the database and tables objects to refer to the current report

crDatabase = crReportDocument.Database

crTables = crDatabase.Tables

'loop through all the tables and pass in the connection info

For Each crTable In crTables

crTableLogOnInfo = crTable.LogOnInfo

crTableLogOnInfo.ConnectionInfo = crConnectioninfo

crTable.ApplyLogOnInfo(crTableLogOnInfo)

Next

'Loop through the sections in the main report to find the subreport objects

'then open the subreport and set the datasource to the subreport

For Each crSection In crSections

crReportObjects = crSection.ReportObjects

For Each crReportObject In crReportObjects

If crReportObject.Kind = ReportObjectKind.SubreportObject Then

crSubreportObject = CType(crReportObject, SubreportObject)

'open the subreport object

crSubreportDocument = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName)

crDatabase = crSubreportDocument.Database

crTables = crDatabase.Tables

'loop through all the tables in the subreport and

'set up the connection info and apply it to the tables

For Each crTable In crTables

'MessageBox.Show(crTable.Name)

With crConnectioninfo

.ServerName = ServerName

.DatabaseName = DatabaseName

.UserID = UserID

.Password = Password

End With

crTableLogOnInfo = crTable.LogOnInfo

crTableLogOnInfo.ConnectionInfo = crConnectioninfo

crTable.ApplyLogOnInfo(crTableLogOnInfo)

Next

End If

Next

Next

End Sub



Edited by techie3 - 20 Mar 2007 at 8:57am
IP IP Logged
techie3
Newbie
Newbie


Joined: 11 Jan 2007
Location: United States
Online Status: Offline
Posts: 18
Quote techie3 Replybullet Posted: 20 Mar 2007 at 11:13am
Resolved, I had used 2 different references of the main report; one that sets the datasource and another where the connection info was held.  There should be just one reference to the main report.
IP IP Logged
BrianBischof
Admin Group
Admin Group
Avatar

Joined: 09 Nov 2006
Online Status: Offline
Posts: 2458
Quote BrianBischof Replybullet Posted: 20 Mar 2007 at 11:45am
glad you resolved it.
Please support the forum! Tell others by linking to it on your blog or website:<a href="http://www.crystalreportsbook.com/forum/">Crystal Reports Forum</a>
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.047 seconds.