QPR Knowledge Base 2016.1



Previous topic Next topic No directory for this topic  


Previous topic Next topic Topic directory requires JavaScript Mail us feedback on this topic!  

Revision history:

Introduced in QPR 7.2.1

Last changed in QPR 2012.2


Creates a connection to the QPR BizArchitecture Server. Useful together with the Authenticate command.




PGApplication.ConnectToServer(ServerAddress, Port)




ServerAddress: IP address or hostname of the QPR BizArchitecture Server. If this setting is empty, the server address configured in the QPR Modeling Client is used. String.

Port: Socket port of the QPR BizArchitecture Server. If this is 0, the server port configured in the QPR Modeling Client is used. Integer.


Required Rights:


None/Administrator. Administrator privileges are needed if the server is changed while a model is open.


Return Values:

Below are listed the return values that this function can return:







RV_LOGIN_FAILED (This value is retuned if there was an existing connection to another server and the user was successfully authenticated. For the new connection the authentication is tried with the same information as with the previous connection, and RV_LOGIN_FAILED is returned if this new check fails. Connection to the new server is opened anyway).



Example Procedure:


Sub ConnectToServerAndAuthenticate()

 Dim iResult

 Dim oModel

 iResult = PGApplication.ConnectToServer("", 4251)

 If (iResult <> 0) Then

   MsgBox "Could not connect to default server: " + PGApplication.GetErrorMessage(iResult)

 End If

 iResult = PGApplication.Authenticate("qpr", "demo", "")

 If (iResult <> 0) Then

   MsgBox "Authentication failed: " + PGApplication.GetErrorMessage(iResult)

 End If

End Sub