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

Stored Procedure (SQL SERVER) X ASP 2

Status
Not open for further replies.

NiteCrawlr

Programmer
Mar 16, 2001
140
BR
I have a stored procedure, created on SQL SERVER:

*******
CREATE PROCEDURE count_visao
@EMPLID char(11),
@RESULTADO numeric(11) output
AS
Set @resultado = 0
IF Exists( Select [EMPLID] FROM [PS_EM_ORG_VISAO_VW] WHERE ([MANAGER_ID] = @EMPLID))
BEGIN
SET @RESULTADO = '1'
END
ELSE
BEGIN
SET @RESULTADO = '0'
END

RETURN @resultado
*******

I know this is how I execute on Query Analyzer:

*******
DECLARE @resposta numeric (11)
EXEC count_visao foto2, @resultado = @resposta output
select @resposta
*******

How do I execute it from an Asp page, and I need the value @resultado have on the Asp page, how can I get that value?
 
The best way IMHO would be to use the command object from ADO. There's a lot of documentation on the web about how this works (e.g.
Hope this helps. Yours,

Rob.
 
Use a connection object.

set conn = server.createobject("ADODB.Connection")
conn.open "insert Driver and DBQ info here"
conn.execute "storedprocture name here"
conn.close
set conn = nothing

to execute a stored procedure, just call it's name in a SQL string passed to the connection object. Harold Blackorby
hblackorby@scoreinteractive.com
St. Louis, MO
 

I've been trying to do the same thing, but I keep getting the following error message when I set Cmd.CommandType = adCmdStoredProc:

ADODB.Command (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

hblackorby: How do you grab the results of the stored procedure call in your example?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top