I use the following subroutine to connect to a different Oracle database during runtime. When I loop through all of the tables I receive the following error on certain tables when I am setting the table location. If I remove the setting of the table location I receive a Vendor Code 942 error which means table or view does not exist. Has anyone else come across this issue?
PrivateSub SetDBLogonForReport(ByRef poReportDocument AsReportDocument, pbNameConnect AsBoolean)
Dim oTable As CrystalDecisions.CrystalReports.Engine.Table
Dim oTableLogonInfo AsTableLogOnInfo
ForEach oTable In poReportDocument.Database.Tables
oTableLogonInfo = oTable.LogOnInfo
With oTableLogonInfo.ConnectionInfo
.DatabaseName = ""
.ServerName = msDataBase
.UserID = msDatabaseUserID
.Password = msDatabasePassword
EndWith
oTable.ApplyLogOnInfo(oTableLogonInfo)
oTable.Location = oTable.Location
Next
EndSub
System.Runtime.InteropServices.COMException occurred
ErrorCode=-2147483142
HResult=-2147483142
Message=
Invalid table number.
statistic_detail {B55C8874-AEFA-44BF-B139-EDF7034F21F2}.rpt
Source=rptcontrollers.dll
StackTrace:
at CrystalDecisions.ReportAppServer.Controllers.DatabaseControllerClass.SetTableLocation(ISCRTable CurTable, ISCRTable NewTable)
at CrystalDecisions.CrystalReports.Engine.Table.set_Location(String value)
at QAReviewControls.NET.clsQAReviewReportViewer.SetDBLogonForReport(ReportDocument& poReportDocument, Boolean pbNameConnect) in C:\Source Code\Source-Work.NET.VS2010\QAReviewControls.NET\clsQAReviewReportViewer.vb:line 278
InnerException: