Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

Information about the new connection object in Integration Manager for Microsoft Dynamics GP 10.0


Summary

This article discusses the new connection object that is available in Integration Manager for Microsoft Dynamics GP 10.0.

↑ Back to the top


INTRODUCTION

Integration Manager has provided an ADO Connection object for Microsoft Dynamics GP 10.0 that replaces the RetrieveGlobals DLL. The reference name of this object is GPConnection. This object exposes the methods and the properties that are listed in this article. The "More Information" section includes Integration Manager script examples of how to use the new connection object in Microsoft Script Editor.

↑ Back to the top


More Information

The GPConnection object

The Open method in the GPConnection object is GPConnection.Open. This method uses the ADO Connection object to establish an open ADO connection that uses the current Microsoft Dynamics GP user logon information. After this call is made, the object is set to an open ADO Connection. After this occurs, the connection can be used the same as any other ADO Connection is used.

Properties of the GPConnection.Open method

  • GPConnection.GPConnUserDate: the current user date
  • GPConnection.GPConnInterCompanyID: the intercompany ID that is the company database ID
  • GPConnection.GPConnUserID: the current user ID
  • GPConnection.GPConnUserName: the current user name
  • GPConnection.GPConnDataSource: the current data source that is used by Microsoft Dynamics GP
Notes
  • The Open method in the GPConnection object uses the data source that is used by the current instance of Microsoft Dynamics GP. This data source does not use a default company (database), such as TWO or GPDAT. To make the data source use a default company, you must set the default company value in the connection string before you call the open method. The connection string cannot be updated after the open method is called.

    The following script is an example of how to set the default company value.
    set MyCon = CreateObject("ADODB.Connection")
    MyCon.Connectionstring = "database=GPDAT"
    GPConnection.Open(MyCon)
  • There is no Close method in the GPConnection object because the method is not required. As soon as the connection is returned in the connection object that is created in the script, that connection object can be closed in the typical way.
  • All properties return string values. An example of such a property is the User Date field.

    The following script is an example of how to take the following actions:
    • make a connection
    • run an update statement to the SQL database
    • retrieve the connection information
    ' Create an ADO record set.
    set recset = CreateObject("ADODB.Recordset")
    ' Create the ADO connection to be used.
    set MyCon = CreateObject("ADODB.Connection")
    ' Initialize the connection string to specify a default database. In this case, the string
    ' is set to the current company. However, the string can be set to a constant. For example,
    ' the string can be to “database=GPDAT.”
    MyCon.Connectionstring = "database=" + GPConnection.GPConnInterCompanyID
    ' Call the GPConnection open method that is passing in the ADO connection that you created.
    ' When the connection returns, MyCon will be set to an open ADO connection.
    GPConnection.Open(MyCon)
    ' Create a string to contain an update call to the customer master table.
    updatecommand = "update RM00101 set [CUSTNAME]='IM Customer' where [CUSTNMBR]='AARONFIT0022'"
    ' Run the update command.
    recset = MyCon.Execute(updatecommand )
    ' Close the ADO connection in the typical way.
    MyCon.Close
    ' Retrieve the properties that are exposed by the new GPConnection object.
    MsgBox GPConnection.GPConnUserDate
    MsgBox GPConnection.GPConnInterCompanyID
    MsgBox GPConnection.GPConnUserID
    MsgBox GPConnection.GPConnUserName
    MsgBox GPConnection.GPConnDataSource

↑ Back to the top


References

For more informationabout the RetrieveGlobals.dll and RetrieveGlobals9.dll files, click the following article number to view the article in the Microsoft Knowledge Base:

913341 How to use the new RetrieveGlobals9.dll file in Integration Manager and in Microsoft Dynamics GP 9.0

↑ Back to the top


Keywords: kbinfo, kbexpertiseadvanced, kbmbspartner, kbexpertisebeginner, kbmbsmigrate, kbhowto, kbexpertiseinter, kb

↑ Back to the top

Article Info
Article ID : 939371
Revision : 1
Created on : 1/7/2017
Published on : 8/2/2011
Exists online : False
Views : 73