This is ADO in classic ASP.
I have a stored procedure with a parameter @IsNew of type int.
I can call it via SQL:
EXEC [dbo].[SearchVehicles]
@WebsiteName = N'AMSVans',
@SortOrder = N'Year DESC,Status ASC',
@Statuses = N'Unsold',
@IsNew = 1
And the return sets are exactly as expected.
However, when I attempt to use it in my web page:
cmd.CommandText = "AMSVans.dbo.SearchVehicles"
cmd.CommandType = adCmdStoredProc
cmd.Parameters.Append cmd.CreateParameter("@WebsiteName", adVarChar, , 75, "AMSVans")
cmd.Parameters.Append cmd.CreateParameter("@SortOrder", adVarChar, , 500, "Year DESC,Status ASC," + SortMethod)
cmd.Parameters.Append cmd.CreateParameter("@Statuses", adVarChar, , 500, Statuses)
cmd.Parameters.Append cmd.CreateParameter("@IsNew", adInteger, , 4,1)
cmd.Parameters.Append cmd.CreateParameter("@Categories", adVarChar, , 500, "AMS Vans")
Set r = cmd.Execute
I get back nothing. Nada. Zilch.
I'm not even sure where to begin debugging this one :-/
Update RE "Set nocount on":
Interestingly, if I turn it off (ie, comment out that line), I get this error:
ADODB.Recordset error '800a0e78'
Operation is not allowed when the object is closed.
/pages/inventory/main.asp, line 109
The line in question (r is the recordset):
if not (r.EOF and r.EOF) then invFound = true