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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting an SP to return a simple int

Status
Not open for further replies.

ryan

Programmer
Nov 13, 2000
73
US
I can't seen to get ASP to simply return something like so. Could you please help, I've been working at this from several angles but I can't seem to get it.

***************************
create proc getnextid as
declare @myid int
begin tran
select @myid = (select idvalue from ids where idfield='nextid')
update ids set idvalue = @myid + 1 where idfield = 'nextid'
commit tran
select @myid as 'myid'
go
***************************
 
create proc getnextid as
declare @myid int OUTPUT
begin tran
select @myid = (select idvalue from ids where idfield='nextid')
update ids set idvalue = @myid + 1 where idfield = 'nextid'
commit tran
select @myid as 'myid'
go

Have to declare it as an output parameter. Then, your ASP page will have read access to it through the command object.

:)
paul
penny.gif
penny.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top