470,815 Members | 1,278 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

Still changing the data connection fo untyped report

I have following code:

Private Sub SetDataBaseLocation(ByVal Report As ReportDocument)
For Each oConnectionInfo As [Shared].IConnectionInfo In
oConnectionInfo.SetConnection(_Servername, _DatabaseName,
_Username, _Password)
oConnectionInfo.SetLogon(_Username, _Password)

For Each SubReport As ReportDocument In Report.Subreports
Catch ex As Exception
'Do nothing
End Try
End Sub

Private Sub AuthenticateAccess()
'Creates a class in order to store the login info
Dim loConnInfo As New CrystalDecisions.Shared.ConnectionInfo
loConnInfo.Type = ConnectionInfoType.Query
loConnInfo.AllowCustomConnection = True
loConnInfo.ServerName = _Servername
loConnInfo.DatabaseName = _DatabaseName
loConnInfo.UserID = _Username
loConnInfo.Password = _Password

Dim loTables As CrystalDecisions.CrystalReports.Engine.Tables
Dim loTable As CrystalDecisions.CrystalReports.Engine.Table
Dim loTableLogonInfo As CrystalDecisions.Shared.TableLogOnInfo

'Loops in each table of the report and applies the login
For Each loTable In Me.Database.Tables
loTableLogonInfo = loTable.LogOnInfo
loTableLogonInfo.ConnectionInfo = loConnInfo
loTable.Location = _Username & "." &
loTable.Location.Substring(loTable.Location.LastIn dexOf(".") + 1)
'End If

For Each Report As ReportDocument In Me.Subreports

'Search for other subreports in case they were ommited
Dim crSections As Sections = Me.ReportDefinition.Sections
For Each crSection As Section In crSections
Dim crReportObjects As ReportObjects =
For Each crReportObject As ReportObject In crReportObjects
If crReportObject.Kind =
ReportObjectKind.SubreportObject Then
Dim crSubReportObject As SubreportObject =
DirectCast(crReportObject, SubreportObject)
Dim subRepDoc As ReportDocument =
crSubReportObject.OpenSubreport(crSubReportObject. SubreportName)
End If
End Sub

These two subs are there to change the data source for an oracle
connection for the report. I have searched in numerous forums and blogs
and knowledge pases about this and everywhere i found that theabove
code is the optimum with exception that it doesn't work.

The report is saved without data. I have two tablespaces that are
completely identical with the exception of the data reiding in their
tables. The company I work in today decided to switch the tablespace
and we found that although we changed all the login credentials for the
old tablespace, supplying the above subs with the credentials of the
new tablespace, the report still connects to the old tablespace.
We tried to change the given credentials to invalid ones, and it gave
as it should a login error.

Now we have the report connecting as user2 but getting data from user1.

Any idea?

Here some system info:
Versions used:

ASP.NET Framework 1 (localhost WinXP SP 2)
Oracle 9i (residing on Linux Red Hat 9 box)
Crystal Reports 10

Dec 20 '05 #1
0 1206

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Pushpendra | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.