Command Output Parameter not returnimg.

  • Thread starter Thread starter mark
  • Start date Start date
M

mark

Hi all,

Can anyone tell me why this code fails to return the output parameter from
the SP.



VB.Net Code ----------------



Dim adoCmd As New ADODB.Command

With adoCmd

.CommandText = "insCarType"

.CommandType = ADODB.CommandTypeEnum.adCmdStoredProc



.Parameters.Append(.CreateParameter("@CarType",
DataTypeEnum.adVarChar, ParameterDirectionEnum.adParamInput, 30, "Ford"))

.Parameters.Append(.CreateParameter("@intID",
DataTypeEnum.adInteger, ParameterDirectionEnum.adParamOutput, , 0))



.ActiveConnection = userConn

.Execute()



Return .Parameters(1).Value

End With



End VB.Net Code ------



SP Code -------

CREATE PROCEDURE [dbo].[insCarType]

( @CarType VARCHAR(30),
@intID INT = NULL OUTPUT )

AS

INSERT INTO CarTypes ( CarType ) VALUES (@CarType)

SET @intID = SCOPE_IDENTITY()

End SP Code -----------------

Many Thanks for any help you can give me
 
Back
Top