
28/07/2006, 14:02
|
 | | | Fecha de Ingreso: julio-2006
Mensajes: 15
Antigüedad: 18 años, 6 meses Puntos: 0 | |
GRACIAS!, Pero me sigue tirando UN resultado, (el nombre) seguro que me estoy equivocando en algo, en definitiva el codigo me quedo asi:
CREATE procedure GetlastName_Gus2
@LEGAJO_PERSONAL varchar (7),
@nombres varchar (20) output,
@apellido varchar (20) output
as
select @nombres = nombres , @apellido = apellido
from personal
where LEGAJO_PERSONAL = @LEGAJO_PERSONAL
GO
************************************************
<%@ Page Language="VB" %>
<%@ import Namespace="System.Data.SqlClient" %>
<%@ import Namespace="System.Data" %>
<%
Dim conPubs As SqlConnection
Dim cmdLastName As SqlCommand
Dim parmLP As SqlParameter
Dim strLastName As String
conPubs = New SqlConnection( "Server=localhost;database=PERSONAL_DE_COMUNICACIO NES;Integrated Security=SSPI")
cmdLastName = New SqlCommand( "GetlastName_Gus2", conPubs )
cmdLastName.CommandType = CommandType.StoredProcedure
' Parametro de entrada del LP
cmdLastName.Parameters.Add( "@LEGAJO_PERSONAL", "20557" )
' 1er. Parametro de salida, Nombre
Dim parmName As New SqlParameter("@Nombres", SqlDbType.VarChar, 40)
parmName.Direction = ParameterDirection.Output
cmdLastName.Parameters.Add(parmName)
' 2do. Parametro de salida, Apellido
Dim parmLastName As New SqlParameter("@Apellido", SqlDbType.VarChar, 40)
parmLastName.Direction = ParameterDirection.Output
cmdLastName.Parameters.Add(parmLastName)
' Ejecuta el Comando
conPubs.Open()
cmdLastName.ExecuteNonQuery()
' Recupera el valor de salida del Parametro
If Not IsDBNull(parmLastName.Value) Then
strLastName = parmName.Value
Else
strLastName = "DESCONOCIDO !!!"
End If
conPubs.Close()
%> El apellido y el nombre es <%=strLastName%> |