When creating a connection to Strategy Intelligence Server 9.x using Strategy SDK 9.x, two connections are created programmatically, one at the server level 'MyDataSource' and one at the project level 'MyProject'.
'log in to Project Source MyDataSource.AuthMode = DssAuthStandard MyDataSource.login = "administrator" MyDataSource.Passwd = "" MyDataSource.Type = EnumDSSDataSourceType.DssDataSourceTypeServer MyDataSource.Mode = EnumDSSConnectionMode.DssConnectionModeServerAccess MyDataSource.Location = "localhost" MyDataSource.Port = 34952 MyDataSource.Init 'Find the project Set MyProjectList = MyDataSource.Enumerator Set MyProject = MyProjectList.ItemByProjectName("Strategy Tutorial") MyProject.Init
In order to disconnect correctly when the code is done executing, both connections need to be terminated:
In VB6
Set objSource = Nothing MyProject.Reset Set MyProject = Nothing MyDataSource.Reset Set MyDataSource = Nothing MySession.Close Set MySession = Nothing
Note: The session object should be the last to be closed otherwise there will always be one connection left out open.
Using C#
finally { if (MySession != null){ MyProject.Reset(); MyProject = null; MyDataSource.Reset(); MyDataSource = null; MySource = null; //Close session MySession.Close(); MySession = null; } }
WARNING MESSAGE:
Customization Code Warning:
This customization is provided as a convenience to Strategy users and is only directly applicable to the version stated. While this code may apply to other releases directly, Strategy Technical Support makes no guarantees that the code provided will apply to any future or previous builds. In the event of a code change in future builds, Strategy may not be able to provide additional code on this matter even though this customization is provided at this time for this specific build