sql - Return a value from stored procedure classic asp -
as noob stored procedures, can't head around how classic asp (vbscript) page return value stored procedure. can write data table ok, it's retrieving stuff has me stuck.
if use basic example. stored procedure should return count of records in table:
create procedure [dbo].[sp_recordcount] select count(*) mytable
what classic asp code (and changes sproc) need write able display value in browser?
once understand how basic output such this, should hopefully(!) able build on knowledge.
thanks.
probably cleanest way modify stored procedure this:
create procedure [dbo].[sp_recordcount] @countresult int output select @countresult = count(*) mytable
... , server-side code call , read value:
dim cmd set cmd = server.createobject("adodb.command") set cmd.activeconnection = .... opened ado connection here cmd.commandtype = adcmdstoredproc 'be sure adcmdstoredproc constant set in scope, or hardcode relevant integer instead' cmd.commandtext = "sp_recordcount" cmd.parameters.refresh cmd.execute dim count count = cmd.parameters(1)
Comments
Post a Comment