|
-
Aug 11th, 2000, 09:58 AM
#1
Thread Starter
Fanatic Member
I am trying to invoke a stored proc with parameters
.. Here is the stored proc
-----------
CREATE PROCEDURE AppreciateYourHelp (@ok integer,
@help varchar(255), @please smallint) WITH RECOMPILE AS
BEGIN
INSERT INTO mytbl(ok,help,finedate,please,mystat)
VALUES (@ok,@help,getdate(),@please,0)
SELECT @@IDENTITY
END
-------
I am hoping to get the @@IDENTITY value returned to me
Here is the VB CODE...
/* Note the following is a function to which I am passing
/* the stored proc concatenated with its arguments in a
/* string variale similar to this:
Argument = "AppreciateYourHelp (" & _
intval & "," & _
"name" & ",0)"
Dim rs As New ADODB.Recordset
Dim ArgConn as new ADODB.Connection
With rs
.CursorLocation = adUseClient 'Need 2 return recordset
.Open Argument, ArgConn,
adOpenStatic , adLockReadOnly, adCmdStoredProc
End With
What's wrong with this?
I should be able to say at this point
x = rs(0)
to get my identity value
but I am getting an error:
but my connection keeps failing on the .open
Can't we pass a stored proc together with its arguments
to a .open????
Help is appreciated
Thanks in advance
-
Aug 11th, 2000, 10:13 AM
#2
Hyperactive Member
Don't think so
I haven't got time to check this one out now but I don't think you can put the parameters into the .open like that. You need to create a command object for the stored proc and populate the Parameters collection with your param's.
Hope this help, got to dash.
That's Mr Mullet to you, you mulletless wonder.
-
Aug 11th, 2000, 10:25 AM
#3
Thread Starter
Fanatic Member
Thanks Paul!
I tried that too.. but the same problem
If you or any one has a working example, I'd appreciate it
Note: that it works without arguments or if the stored
procedure is written to return a single value
Thanks again
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|