
07/08/2006, 14:31
|
| | Fecha de Ingreso: diciembre-2001 Ubicación: Peru
Mensajes: 376
Antigüedad: 23 años, 2 meses Puntos: 0 | |
Problemas con Parametros de Retorno Holas.
Mi problema es este..tengo una plicacion en asp.net pero utilizo el vb para hacer mi codigo.
El aspx tiene 2 text box uno es usuario y el otro password.
En mi base de datos tengo ya la tabla y tengo un solo usuario con su password.
El problema surge cuando al esperar la respuesta de si es usuario o no siempre responde igual. No si es el codigo o el store procedure.
Envio ambos a ver si me pueden ayudar.
Gracias
STORE PROCEDURE
ALTER Procedure PR00001
(
@Usuario varchar(50),
@UPassword varchar(50),
@Resultado varchar(50) output
)
as
Select
@Usuario = Usuario
from
tblUsuario
Where
(tblUsuario.UPassword = @UPassword)
/* ---------------------------------------------------------------------------- */
If @Usuario is Empty
set @Resultado = 'No Existe'
Else
set @Resultado = 'Existe'
CODIGO VB.net
Imports System
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oConn As String
oConn = "Server=LMuro; DataBase= PruebaWeb; Integrated Security = SSPI"
Dim SqlConn As New SqlConnection(oConn)
Dim Command As New SqlCommand
Command.CommandText = "PR00001"
Command.CommandType = CommandType.StoredProcedure
Command.Connection = SqlConn
SqlConn.Open()
Dim Usuario As New SqlParameter("@Usuario", SqlDbType.VarChar, 50)
Usuario.Direction = ParameterDirection.Input
Command.Parameters.Add(Usuario)
Command.Parameters("@Usuario").Value = txtUsuario.Text
Dim Password As New SqlParameter("@UPassword", SqlDbType.VarChar, 50)
Password.Direction = ParameterDirection.Input
Command.Parameters.Add(Password)
Command.Parameters("@UPassword").Value = txtPassword.Text
Dim Resultado As New SqlParameter("@Resultado", SqlDbType.VarChar, 50)
Resultado.Direction = ParameterDirection.Output
Command.Parameters.Add(Resultado)
Command.ExecuteNonQuery()
txtAprueba.Text = Command.Parameters("@Resultado").Value
SqlConn.Close()
End Sub
End Class
Muchas Gracias |