8 thoughts on “How to Create a Simple Login Form Using VB.net and MS Access”

  1. Good afternoon, i have a question about your source code. The part of the EXECUTEREADER, its send me this error and i can’t continue the compile: “System.InvalidOperationException: ‘ExecuteReader:
    The Connection property has not been initialized.'” I need help, please.
    I write you my source code from the login buttom:

    Private Sub bttEntrar_Click(sender As Object, e As EventArgs) Handles bttEntrar.Click
    Dim mensaje As String = “Por favor, Elija su Nombre, el Ayudante y Escriba su Contraseña”
    Dim mens As String = “Contraseña Incorrecta Sr. ” & cbSuperv.Text
    Dim tit As String = “Datos No Válidos”
    Dim cmd As OleDbCommand = New OleDbCommand(“SELECT * FROM SupervisoresProduccion WHERE NombSup='” & cbSuperv.Text & “‘ AND ContraSup='” & txtcontra.Text & “‘”)
    Dim usuSup, contra As String
    Dim sdr As OleDbDataReader = cmd.ExecuteReader()
    If (sdr.Read() = True) Then
    usuSup = sdr(“NombSup”)
    contra = sdr(“ContraSup”)
    MsgBox(“Bienvenido Sr. ” & cbSuperv.Text)
    cbSuperv.Text = “”
    txtcontra.Text = “”
    Dim result = MessageBox.Show(mens, tit, MessageBoxButtons.OK, MessageBoxIcon.Warning)
    End If
    End Sub

Leave a Comment