Microsoft KB Archive/173391: Difference between revisions
(importing KB archive) |
m (Text replacement - """ to """) |
||
Line 30: | Line 30: | ||
Use SET COMMAND = NOTHING after executing the command. | Use SET COMMAND = NOTHING after executing the command. | ||
The | The "Steps to Reproduce Behavior" section below also demonstrates how to ensure that commands can use the same connection. Uncomment the three SET mcommandx = Nothing lines. | ||
== STATUS == | == STATUS == | ||
Line 38: | Line 38: | ||
== MORE INFORMATION == | == MORE INFORMATION == | ||
Active connections on SQL Server may be monitored in SQL Enterprise Manager by bringing up the Current Activity Window, which may be selected from the Server Menu item. The number of connections is listed at the bottom of this window. Each new connection increases the number of idle connections. The refresh button on the toolbar must be pressed to see the changes in the number of connections. Connections may also be monitored using SQL Trace and observing | Active connections on SQL Server may be monitored in SQL Enterprise Manager by bringing up the Current Activity Window, which may be selected from the Server Menu item. The number of connections is listed at the bottom of this window. Each new connection increases the number of idle connections. The refresh button on the toolbar must be pressed to see the changes in the number of connections. Connections may also be monitored using SQL Trace and observing "New Connection" and "Disconnection." | ||
=== Steps to Reproduce Behavior === | === Steps to Reproduce Behavior === | ||
Line 69: | Line 69: | ||
Dim output As Variant</pre> | Dim output As Variant</pre> | ||
<pre> Private Sub close_conn_Click()</pre> | <pre> Private Sub close_conn_Click()</pre> | ||
<p>oconnection.Close Set oconnection = Nothing Unload Me End Sub Private Sub connect_Click() oconnection.Open | <p>oconnection.Close Set oconnection = Nothing Unload Me End Sub Private Sub connect_Click() oconnection.Open "DSN=mymachine;UID=sa;PWD=" End Sub Private Sub test_Click() Set mCommand1.ActiveConnection = oconnection mCommand1.CommandText = "test" mCommand1.CommandType = adCmdStoredProc Set output = mCommand1.CreateParameter(Type:=adInteger, _ Direction:=adParamOutput) mCommand1.Parameters.Append output mCommand1.Execute MsgBox output 'Set cmd.ActiveConnection = Nothing End Sub Private Sub test2_Click() Set mCommand2.ActiveConnection = oconnection mCommand2.CommandText = "test2" mCommand2.CommandType = adCmdStoredProc Set output = mCommand2.CreateParameter(Type:=adInteger, _ Direction:=adParamOutput) mCommand2.Parameters.Append output MsgBox output 'Set cmd.ActiveConnection = Nothing End Sub Private Sub test3_Click() Set mCommand3.ActiveConnection = oconnection mCommand3.CommandText = "test3" mCommand3.CommandType = adCmdStoredProc Set output = mCommand3.CreateParameter(Type:=adInteger, _ Direction:=adParamOutput) mCommand3.Parameters.Append output mCommand3.Execute MsgBox output 'Set cmd.ActiveConnection = Nothing End Sub</p></li></ol> | ||
== REFERENCES == | == REFERENCES == | ||
Line 89: | Line 89: | ||
</span><br /> | </span><br /> | ||
<br /> | <br /> | ||
THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED | THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.</blockquote> | ||
|} | |} | ||
Last reviewed: September 3, 1997<br /> | Last reviewed: September 3, 1997<br /> | ||
© 1998 Microsoft Corporation. All rights reserved. [[../cpyright|Terms of Use.]]<br /> | © 1998 Microsoft Corporation. All rights reserved. [[../cpyright|Terms of Use.]]<br /> |
Latest revision as of 11:06, 21 July 2020
PRB: Multiple Connections Opened Using ADOLast reviewed: September 3, 1997 |
The information in this article applies to:
SYMPTOMSActiveX Data Objects (ADO) commands may open multiple connections on SQL Server even though the same connection has been specified for each command. CAUSEThe connection has not been released by the previously executed command. RESOLUTIONUse SET COMMAND = NOTHING after executing the command. The "Steps to Reproduce Behavior" section below also demonstrates how to ensure that commands can use the same connection. Uncomment the three SET mcommandx = Nothing lines. STATUSThis behavior is by design. MORE INFORMATIONActive connections on SQL Server may be monitored in SQL Enterprise Manager by bringing up the Current Activity Window, which may be selected from the Server Menu item. The number of connections is listed at the bottom of this window. Each new connection increases the number of idle connections. The refresh button on the toolbar must be pressed to see the changes in the number of connections. Connections may also be monitored using SQL Trace and observing "New Connection" and "Disconnection." Steps to Reproduce BehaviorThis code also includes (commented out) the means to force the connections to be closed.
REFERENCESFor additional information on ADO commands download the ADO Help file from the Internet at http://microsoft.com/ado/. Keywords : adoall adoengdb Version : WINDOWS:1.0,1.5 Platform : WINDOWS Issue type : kbprb |
================================================================================ |
Last reviewed: September 3, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.