satyan -1 Newbie Poster
Private Sub btnlogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnlogin.Click
        Dim cmd As New OleDb.OleDbCommand("select * from tblPassword where name='" + txtUsername.Text + "'", conn)
        conn.Open()
        Try
            Dim rdr As OleDb.OleDbDataReader = cmd.ExecuteReader
            If rdr.Read Then
                Dim p As String = rdr(1)
                If txtpassword.Text = p Then
                    Me.Hide()
                    frm3.Show()
                Else
                    MsgBox("Invalid Password!!")
                    txtpassword.Text = ""
                    txtpassword.Focus()
                End If
            Else
                MsgBox("Invalid Username!! Try Again...")
                txtUsername.Text = ""
                txtpassword.Text = ""
                txtUsername.Focus()
            End If
            conn.Close()
        Catch ex As Exception
            MsgBox(ex.Message)
        End Try



    End Sub
sknake commented: duplicate posts -1