Visual Basic .NET and Access Database : How to Create Login and Register System with User Authentication (FULL)
👨🏫 Please watch the top 3 most popular videos on my channel.
🥇 33 Million Views : Programming in Visual Basic .Net How to Connect Access Database to VB.NET : https://youtu.be/cwDqjmSmtMQ
🥈 13 Million Views : Visual Basic .Net : Search in Access Database - DataGridView BindingSource Filter (Part 1/2) : https://youtu.be/UoT2oava9ns
🥉 2 Million Views : Visual Basic .Net : Search in Access Database - DataGridView BindingSource Filter (Part 2/2) : https://youtu.be/e5Dvkw7moWg
VB.NET Source Code by iBasskung.
ModCenter.vb
Option Explicit On
Option Strict On
Imports System.Data.OleDb
Module ModCenter
Public con As New OleDbConnection
Public da As OleDbDataAdapter
Public cmd As OleDbCommand
Public sql As String
Public strLang As String = "VB.NET 2020"
Public strAnd As String = Chr(38) ' &
Public strSpace As String = Chr(32) ' Blank space
Public dbName As String = "Access"
Public mainProjectName As String = "Dormitory Management System."
Public subProjectName As String = "Login System with User Authentication."
' VB.NET 2020 Dormitory Management System.
Public appTitle1 As String = String.Format("{0} {1}", strLang, mainProjectName)
' VB.NET 2020 & Access Dormitory Management System.
Public appTitl1WithDb As String = String.Format("{0} {1} {2} {3}", strLang, strAnd, dbName, mainProjectName)
' VB.NET 2020 Login System with User Authentication.
Public appTitle2 As String = String.Format("{0} {1}", strLang, subProjectName)
' VB.NET 2020 & Access Login System with User Authentication.
Public appTitle2WithDb As String = String.Format("{0} {1} {2} {3}", strLang, strAnd, dbName, subProjectName)
Public conState As Boolean = False
Public currentUserID As String = ""
Public currentUsername As String = ""
Public currentPermission As String = ""
Public Sub ManageConnection()
conState = False
Try
Dim conString As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath
conString &= "\VBDormSystemDatabase.accdb"
If con.State = ConnectionState.Open Then
con.Close()
End If
con.ConnectionString = conString
con.Open()
conState = True
' MessageBox.Show("Connected to Microsoft Access Database.", appTitle1,
' MessageBoxButtons.OK, MessageBoxIcon.Information)
Catch ex As Exception
conState = False
MessageBox.Show("Error Database Connection: " & ex.Message, appTitl1WithDb,
MessageBoxButtons.OK, MessageBoxIcon.Error)
Return
End Try
' Well done ^_^
End Sub
Public Function DisplayData(str As String, tbl As String, myDS As DataSet) As DataSet
If conState = False Then
ManageConnection()
End If
Dim ds As New DataSet
Try
ds.Clear()
da = New OleDbDataAdapter(str, con)
da.Fill(myDS, tbl)
ds = myDS
Catch ex As Exception
ds = Nothing
conState = False
MessageBox.Show("Error Displaying Data: " & ex.Message, appTitl1WithDb,
MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
conState = False
con.Close()
End Try
DisplayData = ds
End Function
Public Function ExecuteDb(mySQL As String) As Boolean
Dim bCheck As Boolean = False
If conState = False Then
ManageConnection()
End If
Try
cmd = New OleDbCommand(mySQL, con)
cmd.CommandTimeout = 600
cmd.ExecuteNonQuery()
bCheck = True
Catch ex As Exception
bCheck = False
MessageBox.Show("Error: " & ex.Message, appTitl1WithDb, MessageBoxButtons.OK, MessageBoxIcon.Error)
Finally
conState = False
con.Close()
End Try
ExecuteDb = bCheck
End Function
End Module
📺 Amazon:
📍 https://www.amazon.com/shop/ibasskung
📺 Pages:
📍 https://www.facebook.com/CodeAMinute
📍 https://www.facebook.com/IbasskungTutorial
📍 https://www.facebook.com/codewithibasskung
📍 https://www.facebook.com/iBasskungAcademy
📺 YouTube:
📍 https://www.youtube.com/c/iBasskung
📺 Udemy:
📍 https://www.udemy.com/user/tanin-sangngam
📺 Twitter:
📍 https://twitter.com/IBasskung
📺 Pinterest:
📍 https://www.pinterest.com/ibasskung
📺 Blogger:
📍 .NET: https://codeaminute.blogspot.com
📍 JAVA: https://javacodeminutes.blogspot.com
📍 VBA: https://vbacodeminutes.blogspot.com
📺 WordPress:
📍
http://myvbdotnet.wordpress.com
💯 THANK YOU SO MUCH 💯
#VisualBasic
#CSharp #iBasskung
Comments
Post a Comment