Im trying to create a login form but i do not really understand where i am not getting it. Can anyone please look through my code and tell me where i am making a mistake.Below is my code.
Imports System.Data.OleDb
Public Class Form1
Dim con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\HP\Documents\regData.accdb")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
con.Open()
Dim cmd As New OleDbCommand("SELECT from regData WHERE username = '" & txtUsername.Text & "' and pswrd = '" & txtPasswrd.Text & "'", con)
Dim sdr As OleDbDataReader = cmd.ExecuteReader()
If sdr.Read = True Then
MsgBox("Login Successful")
Else
MsgBox("CHECK Username/Password")
End If
con.Close()
Catch ex As Exception
MsgBox("ERROR!")
End Try
End Sub
End Class