Hello,
I'm new to here.
My question is i have a table called tblLogin and it has Username and Password and Usertype in it Admin, Normal in usertype. How can i get when the user logs in as admin it shows cmsAdmin and if not admin they are normal it disables cmsAdmin this is the code i currently use for my login system.
I'm new to here.
My question is i have a table called tblLogin and it has Username and Password and Usertype in it Admin, Normal in usertype. How can i get when the user logs in as admin it shows cmsAdmin and if not admin they are normal it disables cmsAdmin this is the code i currently use for my login system.
Code:
Public Class frmLogin
Dim vrfy As Boolean
Private Sub frmLogin_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
If vrfy = False Then
End
End If
End Sub
Private Sub cmdLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLogin.Click
Call IsConnected("Select * from tblAdmin where Username='" & Me.TextBox1.Text & "' and Password='" & Me.TextBox2.Text & "'", False)
If MyDr.Read = True Then
frmMain.Show()
frmMain.cmdLogout.Text = "Logout"
Else
MsgBox("Access Denied!", MsgBoxStyle.Critical, "Error")
Call IsConnected("Insert into tblLog values('" & _
Me.TextBox1.Text & "','" & _
Me.txtDate.Text & "','" & _
Me.txtTime.Text & "')", True)
End If
TextBox1.Text = ""
TextBox2.Text = ""
TextBox1.Focus()
End Sub
Private Sub cmdClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClose.Click
Me.Close()
End Sub
Private Sub frmLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
txtDate.Text = Now.ToString("dd/MM/yyy")
txtTime.Text = Now.ToString("hh:mm:ss tt")
End Sub
End Class
Comment