VB / ADO picks wrong version of stored proc to execute.
Posted on 2002-07-15
I have two procs with the same name. One is compiled under DBO, and the other is compiled under my user ID.
The code to set up the command object is
Dim cmd As ADODB.Command
Set cmd = CtxCreateObject("ADODB.Command")
'Run the procedure
cmd.ActiveConnection = sConnect
cmd.CommandType = adCmdStoredProc
cmd.CommandText = strSQL
By doing this, ADO has always grabbed the version of the stored proc that was compiled under my ID, if there was one, before trying to grab the one compiled under DBO.
However, I notice that when I check the parameters on the Command object after executing that last line, I see that the parameters are from the proc executed under DBO.
This only started happening today. This component has worked correctly for almost a year.
Any ideas why ADO would pick the DBO proc over the proc with the USER ID on the connection?