Why won´t this work?
I´m trying to add a new record in an sp and return the new ID to an asp page. On the row with the Execute-command in the asp code I get the following error message:
Heres the sp code:
And the asp code:
It seems as though the first parameter isn´t noticed... What am I doing wrong?
I´m trying to add a new record in an sp and return the new ID to an asp page. On the row with the Execute-command in the asp code I get the following error message:
Code:
Microsoft OLE DB Provider for SQL Server (0x80040E07)
Error converting data type varchar to int
Heres the sp code:
Code:
CREATE PROCEDURE dbo.sp_AddOrder
@nNewID int OUTPUT,
@sCreatedBy varchar(50)
AS
INSERT
OD_Order
(
CREATED_BY
)
VALUES
(
@sCreatedBy
)
SET @nNewID = @@IDENTITY
And the asp code:
Code:
dim comNew
set comNew=server.createObject("ADODB.Command")
comNew.ActiveConnection = conn
comNew.CommandType = adCmdStoredProc
comNew.CommandText = "sp_AddOrder"
'*** Sätt inparametrar
comNew.Parameters.Append comNew.CreateParameter("nNewID", adInteger, adParamReturnValue, 0, 0)
comNew.Parameters.Append comNew.CreateParameter("sCREATED_BY", adVarchar, adParamInput, 50, Request("REMOTE_ADDR"))
comNew.Execute
session("OD_ID") = comNew.Parameters("nNewID")
It seems as though the first parameter isn´t noticed... What am I doing wrong?