Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > Visual Studio 2005
|
Visual Studio 2005 For discussing Visual Studio 2005. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 5th, 2006, 07:21 AM
Registered User
 
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to use values returned by a Strored Procedure

Hi, i need to user the values returned by a SP, but it doesn't work, this is the SP code:

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS OFF
GO
ALTER PROCEDURE ConsultarSolicitud

@cod_solicitud as int,

 @nombre as char(60) output,
 --@Fecha_Inicio as date OUTPUT,
 @area as char(30) OUTPUT,
 @tipo_soporte as char(15) OUTPUT,
 @descripcion_corta as nvarchar(50) OUTPUT,
 @estado_solicitud as char(15) OUTPUT

AS
--, @Fecha_Inicio = s.Fecha_Inicio
select top 1 @nombre=u.nombre, @area = a.area,@tipo_soporte = ts.tipo_Soporte,@descripcion_corta = s.Desc_Corta ,@estado_solicitud = es.Estado_Solicitud
From solicitud s,usuarios u, areas a, tipo_soporte ts, estado_solicitud es

where s.cod_solicitud =(@cod_solicitud) and s.cod_usuario = u.cod_usuario and s.cod_area = a.cod_area and s.cod_soporte = ts.cod_soporte
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
************************************************** ***************

And i execute the SP from the ASPX form.vb :

            cmdTransaction = cmdConexion.BeginTransaction
            cmdCommand.CommandType = CommandType.StoredProcedure
            cmdCommand.Transaction = cmdTransaction
            cmdCommand.CommandText = "CosultarSolicitud"
            cmdParametro = New SqlParameter("@cod_solicitud", Me.cod_solicitud)
            cmdParametro.DbType = DbType.Int32
            cmdCommand.Parameters.Add(cmdParametro)

            cmdCommand.ExecuteNonQuery()

             nombre = (string)cmdCommand.Parameters["@nombre"].Value;
             area = (string)cmdCommand.Parameters["@area"].Value;

            cmdTransaction.Commit()

************************************************** ****************

The SP executes whitout problems, but i need to use the Output values, how can i do that?

Tks a lot,

FV

 
Old May 7th, 2006, 11:03 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You need to create OUTPUT parameters in your aspx code. .Direction = Output
Then something like
dim your var as integer
yourvar = sqlComm.Parameters("@<youroutputparam>").Value






Similar Threads
Thread Thread Starter Forum Replies Last Post
strored procedure... ethantinder C# 1 May 5th, 2008 01:25 PM
Check the strored procedure running in ASP code kapi.goel ASP.NET 1.0 and 1.1 Professional 0 May 17th, 2006 12:19 AM
Dynamic table values not returned in Netscape jminteer Classic ASP Professional 1 December 16th, 2005 03:43 PM
manipulate multiple returned values from oracle st herlenrosa Pro VB Databases 1 November 12th, 2003 03:24 AM
manipulate multiple values returned by stored proc herlenrosa Beginning VB 6 3 November 11th, 2003 06:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.