Ver Mensaje Individual
  #4 (permalink)  
Antiguo 15/10/2012, 11:27
Avatar de Aquaventus
Aquaventus
 
Fecha de Ingreso: junio-2010
Ubicación: Lima-Peru , En el alba de la naturaleza
Mensajes: 2.105
Antigüedad: 13 años, 10 meses
Puntos: 267
Respuesta: login en vb 2008

Permíteme colocarlo dentro de los códigos GEISHI para tener un mejor panorama... porque así como esta no entiendo...
Código vb:
Ver original
  1. Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_ingresar.Click
  2. 'valida si el usuario y contraseña estan registradas y entra al sistema
  3. Dim ccn As String = "DSN=PostgreSQL35W;UID=mgn_rural;PWD=ruralmgn; "
  4. '<<< PARA SELECCIONAR EL USUARIO Y LA CLAVE DE LA TABLA USUARIO >>>
  5. Dim da As New OdbcDataAdapter("select usuario, contrasenia from tbl_usuarios where usuario='" & txt_usuario.Text & "' and contrasenia='" & txt_contrasenia.Text & "'", ccn)
  6. Dim ds As New DataSet
  7. da.Fill(ds, "tbl_usuarios")
  8. Dim fila As DataRow
  9. '<<< PARA QUE LOS TEXT NO ESTEN VACIO >>>
  10. If txt_usuario.Text = "" And txt_contrasenia.Text = "" Then : MsgBox("Por favor digite el Usuario y la Contraseña para entrar al Sistema...", MsgBoxStyle.Information, "AVISO") : txt_usuario.Select() : Exit Sub
  11. ElseIf txt_usuario.Text = "" Then : MsgBox("Digite el Usuario", MsgBoxStyle.Information, "AVISO") : txt_usuario.Select() : Exit Sub
  12. ElseIf txt_contrasenia.Text = "" Then : MsgBox("Digite la Clave", MsgBoxStyle.Information, "AVISO") : txt_contrasenia.Select() : Exit Sub
  13. End If
  14. For Each fila In ds.Tables("tbl_usuarios").Rows
  15. '<<< SI EL USUARIO Y LA CLAVE SON CORRECTAS PASA AL PROXIMO FORMULARIO >>>
  16. If txt_usuario.Text = fila!usuario And txt_contrasenia.Text = fila!contrasenia Then : Hide() : Opciones.Show() : txt_usuario.Text = "" : txt_contrasenia.Text = "" : Exit Sub
  17. End If
  18. Next
  19. '<<< SI NO SON CORRECTAS EMITIRA EL SIGUIENTE MANSAJE >>>
  20. MsgBox("Usuario Incorrecto. Este Usuario no se encuentra registrado en el Sistema...", MsgBoxStyle.Critical, "AVISO")
  21. txt_usuario.Text = ""
  22. txt_contrasenia.Text = ""
  23. txt_usuario.Select()
__________________
Internet es tener todo el conocimiento global a tu disposición.
Desarrollo de Software - Ejemplos .Net