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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -