Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim b As String = ""

        If TextBox1.Text = "" Or TextBox2.Text = "" Then
            MsgBox("Data tidak lengkap", MsgBoxStyle.Information, "Login")
        Else
            conect = "select * from tbl_id"
            cmd = New SqlCommand(conect)
            dr = cmd.ExecuteReader()
            Try
                While dr.Read
                    If TextBox1.Text = dr("id") And TextBox2.Text = dr("pass") Then
                        b = "Ya"
                        Exit While
                    End If
                End While
                If b = "Ya" Then

                    Me.Hide()
                Else
                    MsgBox("ID Karyawan atau Password tidak ditemukan", MsgBoxStyle.OkOnly, "Login")
                End If
            Catch ex As Exception
                MsgBox(ex.Message)

            End Try
            dr.Close()

        End If
    End Sub

Recommended Answers

All 2 Replies

Your program is incomplete. See the database section (Chapter 13) of this tutorial

You didn't set the connection string. There is the same problem, just search this forum.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.