I have been working out of an older ASP/Visual Basic/SQL Server Developers Guide. My code is exactly as written in the book but I still can't seem to get the asp to collect the information from the Stored Procedure.
My asp page calls for the Procedure:
'check to see if a basket has been created if session("idBasket") = "" then set dbBasket = server.CreateObject("adodb.connection") set rsBasket = server.CreateObject("adodb.recordset") dbBasket.open "Provider=sqloledb;Data Source=(local);Initial Catalog=EcommerceDB;User Id=sa;Password=12511;" sql = "execute sp_CreateBasket " & session("idShopper") set rsBasket = dbBasket.Execute(sql)
The Stored Procedure is this simple:
Create Procedure sp_CreateBasket @idShopper int AS Insert into basket(idShopper) values(@idShopper) Select idBasket = @@identity
Then I call the information from my asp like this:
idBasket = rsBasket("idBasket")
And that is where the error comes in.
Item cannot be found in the collection corresponding to the requested name or ordinal.
I have tested the Procedure in SQL Analyzer and it returns idBasket with the correct number.