As the headling says I want to call a stored procedure with parameters.
Below is the VB6-function that
Private Sub TestProcedur()
Dim strSql As String
Dim CPw As rdoQuery
strSql$ = "? = {call Insert_Student(?) }"
Set CPw = gRdoConn.CreateQuery("InsertStudent", strSql)
CPw.rdoParameters(0).Direction = rdParamReturnValue
CPw(1) = "FRANK"
Set mrsR = CPw.OpenResultset()
End Sub
The stored procedure below
CREATE PROCEDURE Insert_Student
@Name VARCHAR(50)
AS
BEGIN
INSERT INTO dbo.Student (Name)
VALUES (@Name)
END
GO
I’m getting a problem when running the function. A ERROR messsage occurs when running the line “CPw.rdoParameters(0).Direction = rdParamReturnValue” that says: Not valid description index”
This page on MSDN should explain it nicely:
http://msdn.microsoft.com/en-us/library/aa240826%28v=VS.60%29.aspx