I'm not well versed in ASP, but that's what I've got to work with for the moment. I have a stored procedure that generates a resultset which i'd like to handle in classic ASP. I can see the resultset if I run the SP in SQL Management Studio with the same parameter so I know its working.
The stored procedure takes 1 parameter @part, i've testing with the following code and can see the SP is executed using SQL Profiler, but I get a '500 - Internal server error' returned from ASP instead of a resultset displayed.
How do correctly retrieve the resultset?
Dim fpart, objCommand, objRecordset
fpart = "SMF10320BRNU12"
Set objCommand = Server.CreateObject("ADODB.Command")
With objCommand
.ActiveConnection = db
.CommandText = "sp_movements"
.CommandType = 4
.CommandTimeout = 240
.Parameters.Append .CreateParameter("@part", 200, 1, 20)
.Parameters("@part") = fpart
Set objRecordset = .Execute
End With
for each x in objRecordset.Fields
Response.Write(x.name)
Response.Write(" = ")
Response.Write(x.value & "<br />")
next
Response.Write("<br />")
objRecordset.MoveNext
objRecordset.Close
Set objRecordset = nothing
objCommand.Close
Set objCommand = nothing