Start New Discussion within our Software Development Community
Public Sub login()
        SQLConnection.ConnectionString = ServerString
        cmd.Connection = SQLConnection
        SQLConnection.Open()
        cmd.CommandText = "SELECT employee_id, password FROM employees_list WHERE employee_id='" & Form1.EMPLOYEE_ID_txt.Text & "' and password='" & Form1.PASSWORD_txt.Text & "'"
        dr = cmd.ExecuteReader()
        If dr.HasRows Then
            Form1.PASSWORD_txt.Text = ""
            dr.Close()
            Form1.Hide()
            MessageBox.Show("Signed in", "", MessageBoxButtons.OK, MessageBoxIcon.Information)
'get firstname and lastname"
label4="firstname lastnamee"


        ElseIf Form1.PASSWORD_txt.Text = "" Or Form1.EMPLOYEE_ID_txt.Text = "" Then
            MessageBox.Show("Please complete the required fields..", "Authentication Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
            SQLConnection.Close()
        Else
            MessageBox.Show("Username and Password do not match..", "Authentication Failure", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
            'Clear all fields
            Form1.PASSWORD_txt.Text = ""
            Form1.EMPLOYEE_ID_txt.Text = ""
            SQLConnection.Close()
        End If
    End Sub

im making a login form where the user types the employee id and password
if both fields are true how can i get the values of firstname and lastname from sql?

sorry for my english.

You are not pointing to your tabase location, something like:

 AccessConnect = "Driver={Microsoft Access Driver (*.mdb)};" & _
                     "Dbq=nwind.mdb;" & _
                     "DefaultDir=C:\program files\devstudio\vb;" & _
                     "Uid=Admin;Pwd=;"
This question has already been answered. Start a new discussion instead.