Problem accessing stored procedure in classic ASP
Hello. I need some help.
I have a stored procedure named createID on a MS SQL Server database. The procedure takes no input, and returns a BigInt.
I can call it from my SQL Server client as follows:
The above works, and the procedure returns a number as expected. However, I have problems trying to call it from (classic) ASP.
declare @foo BIGINT
execute createID @foo OUTPUT;
select @foo as "FaxID";
I have tried the following:
When I call the above function using the connection string for the database (the connection string is right, it works on other functions), I get the following IIS error:
Dim Connection, cmd
Set Connection = Server.CreateObject("ADODB.Connection")
Set cmd = Server.CreateObject("ADODB.Command")
Set cmd.ActiveConnection = Connection
cmd.CommandText = "createID"
cmd.CommandType = adCmdStoredProc
cmd.Parameters.Append cmd.CreateParameter("FaxID", adBigInt, adParamOutput)
getFaxId = cmd(0)
I have also tried the following variants:
1. cmd.CreateParameter("FaxID", adBigInt, adParamReturnValue)
2. cmd.CreateParameter("FaxID", adBigInt, _, adParamOutput)
3. cmd.CreateParameter("FaxID", adBigInt, _, adParamReturnValue)
Neither has worked. They all yield the same error message.
Does anyone have any idea what may be wrong? (Sorry, it's my first time calling a stored procedure from ASP and I can't seem to find the answer online).
Thank you in advance.