PR Reviewer
PR Reviewer
MySqlClient
txtPassword.Text = ""
txtUsername.Select()
Else 'Restriction 2: Data must matched to ur database.
cmd = New MySqlCommand("Select * FROM tblLogin WHERE UName = @UName and PWord
= @PWord", con) 'cmd = new mysqlcommand ("query",database location/path)
cmd.Parameters.AddWithValue("@UName", txtUsername.Text)
cmd.Parameters.AddWithValue("@PWord", txtPassword.Text)
dr = cmd.ExecuteReader
dr.Read()
MsgBox("ACCESS GRANTED: Hi! " & txtUsername.Text & ", welcome to Student
Management System Dashboard.", MsgBoxStyle.Information, "LOGIN SECURITY: Access Granted")
txtUsername.Text = ""
txtPassword.Text = ""
Me.Hide()
frmMain.Show()
txtPassword.Text = ""
txtUsername.Select()
End If
End If
dr = Nothing
con.Close()
'If txtUsername.Text = "" Or txtPassword.Text = "" Then
'Else
' cmd = New MySqlCommand("Select * FROM tblLogin WHERE UName = @UName and
PWord = @PWord", con)
' dr = cmd.ExecuteReader
' dr.Read()
' Me.Hide()
' frmMain.Show()
' Else
' MsgBox("ACCESS DENIED: Either username or password is incorrect",
MsgBoxStyle.Exclamation, "LOGIN SECURITY: Access Denied.")
' cp += 1
' If cp = 3 Then
' End
' End If
' End If
' dr = Nothing
' con.Close()
' End If
End Sub
DBConnect()
End Sub
End Class
Module modConnection
Public con As New MySqlConnection 'Function used to set the connectionstring.
Public cmd As New MySqlCommand 'Function used to set the SQL.
Public dr As MySqlDataReader
With con
'To display or notify the user that we are connected to our database.
'MsgBox("This application is now connected to the database.",
vbInformation, "SMSDB: Message Prompt")
End With
Catch ex As Exception
End Try
End Sub
End Module