TUTORIALS SIMPLE LOGIN CODE WITH MS ACCESS DATABASE VB.NET
VB.NET TUTORIALS
SIMPLE LOGIN CODE WITH MS ACCESS DATABASE
Create MS Database
2x Textbox
1 Button
Imports System.Data.OleDb
Imports System.Media
Dim path = System.Windows.Forms.Application.StartupPath
Dim connection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Database1.mdb;")
Dim command As New OleDbCommand("SELECT [ID] FROM [Users] WHERE[passwordField] = Password", connection)
Dim PasswordParam As New OleDbParameter("Password", Me.Textbox2.Text)
command.Parameters.Add(PasswordParam)
command.Connection.Open()
Dim reader As OleDbDataReader = command.ExecuteReader
If reader.HasRows Then
MessageBox.Show("Access Granted !")
Me.Textbox2.Text = ""
Me.Hide()
Form5.Show()
Else
MsgBox("Wrong Password please try again!", , "Access Denied")
Me.Textbox2.Text = ""
End If
command.Connection.Close()
Comments
Post a Comment