Desktop version

Main > Forum > 1C:Enterprise Platform > 1C:Integration > How to close COM connection

Forum

Search UsersRules
How to close COM connection
#1
Active user
Points:: 2
Joined:: Sep 16, 2011

Hello!

I have a problem with understanding the COM connection. I do the following:

Code
   Com = New COMObject("V82.COMConnector");
   Connection = Com.Connect("Srvr=server:1541;Ref=infobase;Usr=Administrator;Pwd=*****");

But can not understand how to close the connection. Sometimes it closes before I need to use it and sometimes it remains open when it is not needed.

Profile
#2
Active user
Points:: 0
Joined:: Nov 1, 2011

I think the platform should close the connection with the destruction of the variable.
You can close it forceably by setting Conn = Undefined;

Profile
#3
Active user
Points:: 2
Joined:: Sep 16, 2011

And what can I do to force it not to close the connection between procedure calls until the user closes the main application?

Profile
#4
Active user
Points:: 0
Joined:: Nov 1, 2011

Use a variable of the module

Profile
#5
Active user
Points:: 0
Joined:: Nov 1, 2011

If you want to use com object within all user session you should insert it into session parameter using temporary storadge

Code
SessionParameters.YourParametr=PutToTempStorage(Conn, New UUID)

Profile
#6
Active user
Points:: 2
Joined:: Sep 16, 2011

Thanks, Alexey. But wouldn't it destroy a COM object when procedure which places it into temp storage ends?

Profile
#7
Active user
Points:: 0
Joined:: Nov 1, 2011

Please explain your task.
Do you want to use the same com object during all user session or just one server call?

Profile
#8
Active user
Points:: 2
Joined:: Sep 16, 2011

I want to run a supplementary 1C:Enterprise instance with another application for interacting with it during all session of users with the given role. Users of this role should enter data in realtime to be used by users working in both applications. Due to security reasons we would like to have separate application for storing secret information.

Profile
#9
Just came
Points:: 0
Joined:: Nov 2, 2011

Xin Wang, did you consider web-services?

Profile
#10
Active user
Points:: 2
Joined:: Sep 16, 2011

No, I'm doing some integration with Microsoft Office applications. Why?

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.