Hi,
I have the following problem when I change to another Data Base that I have in the same server, without closing and opening again the SBO client, using an
AddOn.
The object used to change the Data Base for the refresh of the ADDON is company.
The system tells that the AddOn is now connected to the other Data Base but it doesnt work.
This problem is regarding a company that has multi-companies that use the same AddOn, it doesnt refresh it when I change from one Data Base to the other.
The Code use it is:
'//////////////////////////////
' Reconecta a la base de datos
'//////////////////////////////
Public Sub GEI_ReconnectToCompany()
Dim liSegs As Integer
Call DisconnectToCompany
Call Init_Connection(liSegs, "Principal")
End Sub
'//////////////////////////////
' Inicia la conexion a la base de datos
'//////////////////////////////
Private Sub Init_Connection(aiTimer As Integer, asTipoConnection As String)
Dim li_veces As Integer
If Not goCompany Is Nothing Then
If goCompany.Connected = True Then
'Call DisconnectToCompany
Exit Sub
'Else
'Call GEI_Espera(aiTimer)
End If
'Else
' Call GEI_Espera(aiTimer)
End If
Call SetApplication
If Not SetConnectionContext = 0 Then
goApp.MessageBox "Fallo de conexión a DI API"
End
End If
goApp.SetStatusBarMessage "Conectando DataInterfaces " + asTipoConnection + " ..."
li_veces = 1
Do While li_veces < 3
If ConnectToCompany = 0 Then
Exit Do
End If
'Call GEI_Espera(aiTimer)
li_veces = li_veces + 1
Loop
If li_veces >= 3 Then
goApp.MessageBox "Fallo de conexión a la base de datos"
End
End If
goApp.SetStatusBarMessage goApp.Company.UserName + ", Bienvenido a : " & goCompany.CompanyName
End Sub
Private Sub SetApplication()
Dim sConnectionString As String
Set goGuiApi = New SAPbouiCOM.SboGuiApi
sConnectionString = Command
goGuiApi.Connect sConnectionString
Set goApp = goGuiApi.GetApplication()
End Sub
Private Function SetConnectionContext() As Long
Dim sCookie As String
Dim sConnectionContext As String
Dim lRetCode As Long
Set goCompany = New sapbobscom.Company
sCookie = goCompany.GetContextCookie
sConnectionContext = goApp.Company.GetConnectionContext(sCookie)
SetConnectionContext = goCompany.SetSboLoginContext(sConnectionContext)
End Function
Private Function ConnectToCompany() As Long
ConnectToCompany = goCompany.Connect
End Function
Private Sub DisconnectToCompany()
goCompany.Disconnect
End Sub
-
-
I will like to know what I have to do to manage this.
Kind Regards,
Cristian Moreno