Quantcast
Channel: SCN : Discussion List - SAP Crystal Reports, version for Visual Studio
Viewing all articles
Browse latest Browse all 3636

SetTableLocation with Oracle table : fail to load database information

$
0
0

Hi,

 

I'm making an utility which can replace an Oracle table/view by another one then save the modified report.

 

I'm using Visual Studio 2012 and CRforVS 13 SP6.

 

When SetTableLocation is called, I get an error "fail to load database information...".

 

My source below :

 

    Private Function ReplaceTable() As Boolean        Dim crTableNew As Table          For Each crTableOld As Table In ClientDocument.DataDefController.Database.Tables            If mReplacedTableNames.ContainsKey(crTableOld.Name) Then                crTableNew = GetNewTable(crTableOld)                  If crTableNew IsNot Nothing Then                    Try                        ClientDocument.DatabaseController.SetTableLocation(crTableOld, crTableNew)                        mReplacedTableNames.Remove(crTableOld.Name)                      Catch ex As Exception                        MsgBox(ex.Message, MsgBoxStyle.Critical)                        Return False                      End Try                 Else                    Return False                  End If              End If        Next          Return True      End Function    Private Function GetNewTable(crTable As Table,                                 Optional newTableName As String = "") As Table        Dim crTableNew As Table        Dim crConnInfo As New ConnectionInfo        Dim pBag As New PropertyBag        Dim crConnProperties As New PropertyBag         If newTableName = "" Then newTableName = crTable.Name         Try            crTableNew = crTable.Clone(True)              pBag.StringValue("QE_ServerDescription") = crTable.ConnectionInfo.Attributes.StringValue("QE_ServerDescription")            pBag.StringValue("QE_SQLDB") = "true"            pBag.StringValue("QE_DatabaseType") = "Oracle Server"            pBag.StringValue("SSO Enabled") = "false"            pBag.StringValue("Database DLL") = "crdb_oracle.dll"              crConnProperties.StringValue("Trusted Connection") = "false"            crConnProperties.StringValue("Server") = crTable.ConnectionInfo.Attributes.StringValue("QE_ServerDescription")              pBag.Add("QE_LogonProperties", crConnProperties)              crConnInfo.Attributes = pBag             crTableNew.ConnectionInfo = crConnInfo             crTableNew.Name = newTableName            crTableNew.QualifiedName = crTable.ConnectionInfo.UserName.ToUpper() + "." + newTableName              Return crTableNew         Catch ex As Exception            MsgBox(ex.Message, MsgBoxStyle.Critical)            Return Nothing          End Try      End Function    Public Function Save() As Boolean        If ReplaceTable() = True Then            Try                mRptDocument.SaveAs(mRptDocument.FileName)                mNeedToSave = False                Return True             Catch ex As Exception                MsgBox(ex.Message, MsgBoxStyle.Critical)                Return False            End Try        Else            Return False        End If    End Function

 

Please someone can help me.


Viewing all articles
Browse latest Browse all 3636

Trending Articles