all groups > dotnet academic > february 2004 >
You're in the

dotnet academic

group:

Call SP with existing connection


Call SP with existing connection mj
2/17/2004 6:56:07 AM
dotnet academic:
I have a stored procedure, and it is working fine, but my problem is, how do I call it with an existing connection? Notice that I have to add my conn all the time, and would like to call it with an existing connection (in this case conn) Thanks

Private Sub SPCALL_Click(

Dim CMD As New ADODB.Comman
Dim conn As New ADODB.Connectio
Dim RS As New ADODB.Recordse
'i would like to get rid of the conn.open and use an existing one
conn.Open "DRIVER={SQL Server};SERVER=128.145.458.78;UID=sa;PWD=pass;DATABASE=HR

CMD.ActiveConnection = con
CMD.CommandText = "[sendme]
CMD.CommandType = adCmdStoredPro
Set RS = CMD.Execut

Set RS = Nothin
Set CMD = Nothin

Re: Call SP with existing connection Peter van der Goes
2/17/2004 10:24:33 AM

[quoted text, click to view]
do I call it with an existing connection? Notice that I have to add my conn
all the time, and would like to call it with an existing connection (in this
case conn) Thanks.
[quoted text, click to view]

Have you tried creating a global, or form level, connection object, then
using it in your subprocedure? You would want to check (if the connection is
to be used in several places) to be sure the connection has not been left
open before new parameter are applied with a new "open", then be sure you
close the connection when you are finished with it, each time it's used.

--
Peter [MVP Academic]

AddThis Social Bookmark Button