stored procedure problem

S

Savas Ates

CREATE PROCEDURE zzz @userid numeric(18),@polim numeric(18) OUTPUT
AS


select * from users where userid=@userid

select @polim= count(*) from users
return (@polim)
GO

*********************
how can i gain the value of @polim in asp

in asp

set rs=baglantim.execute ("declare @sa as int exec zzz @userid='21',
@polim=@sa OUTPUT")

response.write rs("@sa")
like this (only i tried i dont know how can i gain the value it with execute
method....)
 
B

Bob Barrows [MVP]

Roji. P. Thomas said:
1. a RETURN value and OUTPUT value are differenct.
2. You can only RETURN an integer value.
3. Your SP RETURNS and OUTPUTS the count value.

To see how to use them from ASP, read

http://www.adopenstatic.com/faq/recordcountalternatives.asp
and http://www.adopenstatic.com/faq/SprocsAndParameters.asp
The second FAQ article is very relevant. The only thing I have to add is
that stored procedure code generators exist. There's been a VB Addin
available for years that generates the VB code needed to create a Command
object and build the Parameters collection. I adapted that Addin, fixing a
couple deficiencies along the way, to enable it to generate the equivalent
vbscript code. It is available here:
http://www.thrasherwebdesign.com/index.asp?pi=links&hp=links.asp&c=&a=clear

Since you will have the source code, you will be able to modify it to do
what you want (say, for example, you don't like the variable names I used:
modify the vbscript to use your variable names.)


Bob Barrows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top