
HELP! CreatePreparedStatement and SQL Server 6.0 stored procedure
Hi all,
The following message is wordy and probably incoherent, but please bear
with me...
I am trying to execute a stored procedure on a SQL Server 6.0 database
from an OLE DLL. I want to execute the sp_addlogin system-level stored
procedure, using question marks as parameter markers. I am issuing the
following...
I have an object oAddUser As rdoPreparedStatement,
moConnection as rdoconnection
sStmt as string
sStmt = "{ ? = call sp_addlogin (?, ?, ?) }"
set oadduser = createpreparedstatement("SetLogin", sStmt)
Then I want to set the different parameters to their associated string
values (loginID, Password, default database). I don't need to set the
direction property of the first parameter, because SQL server knows that
it is a return value (VB4.0 Enteprise online help - Direction property).
BUT...It seems that oadduser.rdoparameters.count = 0! It should equal
4. So when I try to set oadduser.rdoparameters(1) = sLogin, it craps
out and tells me "Invalid parameter passed." It apparently does not
like me referencing collection item 1 when the count of collection items
is 0.
It seems as though the driver is not finding/translating the question
marks as parameter markers.
If I change the second parameter of the createpreparedstatement method
to be a SQL SELECT with a ? in the where clause, it tells me that the
count of parameters is 1, which is correct! But I'm working with stored
procedures, so the SQL SELECT is useless!!
I'm logged into the SQL Server as SA, so I'm sure I have the rights to
be using sp_addlogin.
A Microsoft rep mentioned that SQL Server is very picky about the
cursordriver property of the rdoenvironment when working with
parameterized stored procedures. Our cursordriver is set at Server-Side
cursors (2).
Any solutions or suggestions!
Thanks!!
Peace,
Gary