Ver Mensaje Individual
  #3 (permalink)  
Antiguo 30/11/2013, 09:30
Avatar de aid_val
aid_val
 
Fecha de Ingreso: mayo-2013
Ubicación: Guanajuato
Mensajes: 302
Antigüedad: 11 años
Puntos: 5
Respuesta: login y registro de usuario

Hola hola, si usas Login1_Authenticate es mucho mas sencillo hacer lo que buscas.
Código VB:
Ver original
  1. '  previousConnectionState = conn.State
  2.        Try
  3.             Dim strSQL As String
  4.            
  5.             strSQL = "SELECT * FROM USUARIOS WHERE USUARIO='" & Login1.UserName & "' AND CONTRASEÑA='" & Login1.Password & "'"
  6.            
  7.             Dim com As New SqlClient.SqlCommand(strSQL, conn)
  8.                 Dim reader As SqlClient.SqlDataReader
  9.                 conn.Open()
  10.                 reader = com.ExecuteReader
  11.                 If Not reader.Read Then
  12.                     conn.Close()
  13.                 Else
  14.                     conn.Close()
  15.                     Session("usuario") = Login1.UserName
  16.                     Session("contraseña") = Login1.Password
  17.                 Response.Redirect("inicio.aspx")
  18.                 End If
  19.  
  20.         Catch ex As Exception
  21.             Login1.FailureText = "Error: " & ex.Message
  22.         End Try