473,246 Members | 1,812 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,246 software developers and data experts.

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
Report.DataSourceConnections
oConnectionInfo.SetConnection(_Servername, _DatabaseName,
_Username, _Password)
oConnectionInfo.SetLogon(_Username, _Password)
Next

Try
For Each SubReport As ReportDocument In Report.Subreports
SetDataBaseLocation(SubReport)
Next
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
information
For Each loTable In Me.Database.Tables
loTableLogonInfo = loTable.LogOnInfo
loTableLogonInfo.ConnectionInfo = loConnInfo
loTable.ApplyLogOnInfo(loTableLogonInfo)
loTable.Location = _Username & "." &
loTable.Location.Substring(loTable.Location.LastIn dexOf(".") + 1)
Next
'End If

For Each Report As ReportDocument In Me.Subreports
AuthenticateAccess(Report)
Next

'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 =
crSection.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)
AuthenticateAccess(subRepDoc)
End If
Next
Next
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 1283

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Pushpendra | last post by:
I want to create the crystal report in my VB.net application...the connectivity and creation of dataadapter and dataset is done thru coding...the dataset we get is untyped now how to bind this...
0
by: Stedak | last post by:
We are trying to use untyped reports in a C# application. Since the reports are being written by a third party the connection information needs changed at runtime. It will always be a ODBC SQL...
5
by: DraguVaso | last post by:
Hi, Something I don't understand about a Typed DataSet: When a value in the DataSet is DBNull, it throws this error: "Cannot get value because it is DBNull". But aren't Typed DataSets...
3
by: Jeff | last post by:
Hi I have a report with a graph on it and want to change the minimum and maximum values for the value axis when it is previewed. This can't be done by adding code in the Open event as once the...
1
by: sandeepjakhotya | last post by:
Hello All Enyone knows how to change DB Location for the Crystal Report in VB 6. I have created a application in vb 6 and report in crystal report 9.0 The report created is then added to vb...
0
by: Crash | last post by:
Hello everyone, I need help creating an asp page to view a crystal report, which requires that that I change the database connection dynamically. I thought I had this problem licked in CR7 (the...
5
by: adeel shahid | last post by:
I m using .NET Crystal Report but i have to create report using different servers. right now the connection string is static using store procedure but i want to change the connection string at...
2
by: hmznzr | last post by:
i am using b.net 2005. i am generating a crystal report. but when i work in a different computer i have to set the location of the database of the report before i generate. is their any dynamic way...
7
OuTCasT
by: OuTCasT | last post by:
I know how to change the database and sqlserver for a crystal report Dim report As New ReportDocument Dim connection As IConnectionInfo Dim oldServerName As String =...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.