Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/10/2011, 09:36
TeRrYNDa
 
Fecha de Ingreso: septiembre-2011
Mensajes: 2
Antigüedad: 12 años, 6 meses
Puntos: 0
Login de SQL con clases

YA estoy loko soy nuevo en esto pero quiero hacer un login con un procedimiento almacenado pero tambien con clases y no se como hacerlo algien me ayuda estoy intentando pero cuando quiero comparar los valores le doy la fila 0 el item 0 pero me sale valor no existe o esta vacio aqui les dejo mi codigo

alter procedure SP_Ingresar
(@correo varchar(250),
@pass varchar(50)
)
as
begin
select
dbo.TBL_POSTULANTES.email,
sesion.Pass
from
dbo.TBL_POSTULANTES,
Sesion
where
email = @correo and Pass = @pass
end


"de la clase"

Imports System.Data.SqlClient
Imports System.Data
Public Class Ingresar
Inherits Conexion
Dim cmdSesi As New SqlCommand
Dim daSesi As New SqlDataAdapter
Dim dtsSesi As New DataSet
Public Function Sesion(ByVal correo As String, ByVal pass As String)
If CN.State = ConnectionState.Closed Then CONECTARBD()
cmdSesi = New SqlCommand
With cmdSesi
.CommandType = CommandType.StoredProcedure
.CommandText = "SP_Ingresar"
.Connection = CN
.Parameters.AddWithValue("@Correo", correo)
.Parameters.AddWithValue("@pass", pass)
End With
daSesi.SelectCommand = cmdSesi
dtsSesi = New DataSet
daSesi.Fill(dtsSesi, "Ingreso")
Return dtsSesi.Tables("Ingreso")
End Function
End Class


del boton en el aspx

Imports Dato = Datos.Ingresar
Partial Public Class Ingresar2
Inherits System.Web.UI.Page
Dim objsesion As New Dato
Dim validar As New DataTable
Dim mail, pass As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click

validar = objsesion.Sesion(txtmail.Text, txtpass.Text)
mail = txtmail.Text
pass = txtpass.Text
If validar.Rows(0).Item(0) Then
Response.Redirect("Avisos.aspx")
Else
Response.Redirect("Postular.aspx")
End If



End Sub
End Class



suplico me ayuden ya e visto muchos tutoriales pero no los entiendo mucho