Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript for SQL return value rec count fails

Status
Not open for further replies.

mty

Programmer
Oct 10, 2002
2
US
My script for a simple call on a record count displays error message:

(stored procedure)
CREATE PROCEDURE ad_GoldPrFix_ProdSoldByWT_Count
AS
Declare @count Int
Select @count=count(ProductID)
From ASPProducts
Where OneSoldByWt = 1
Return @count

(VBScript after adovbs.inc, connection & Dims)
Set objCmd = Server.CreateObject("ADODB.Command")
Set objParm = Server.CreateObject("ADODB.Parameter")
objCmd.ActiveConnection = Conn
ObjCmd.CommandText = "(? = Call dbo.ad_GoldFix_ProdSoldByWT_Count)"
objCmd.CommandType = adCmdStoredProc
Set objParm = objCmd.CreateParameter("Return",adInteger,adParamReturnValue,5)
objCmd.Parameters.Append(objParm)
objCmd.Execute 'line 38 see error msg
Response.Write "There are " & objCmd.Parameters.Item("Return").Value & _
" records in ASPProducts.OneSoldByWt"
Set objCmd = Nothing
Set objParm = Nothing

(error msg)
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'

No value given for one or more required parameters.

/aaaUD.asp, line 38

tried a different way of adding parameters with no joy
i.e.
ObjCmd.Prepared = False
Set objParm1 = Server.CreateObject("ADODB.Parameter")
objParm1.Name = "return"
objParm1.Type = adInteger
objParm1.Direction = adParamReturnValue
objParm1.Precision = 5
objParm1.NumericScale = 0
objCmd.Parameters.Append(objParm)

I'm missing something - any help appreciated
mty
 
all "objParm1" should be "objParm", sorry for the typo
Marty
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top