Database 在vb.net 2010中重定向管理面板上的管理帐户?
你们能帮帮我吗。我想将管理员帐户重定向到管理员面板, 情况是: 我将以管理员帐户登录,它将重定向到管理员面板,如果不是,它将重定向到用户窗体 这是我的代码:Database 在vb.net 2010中重定向管理面板上的管理帐户?,database,vb.net,user-accounts,Database,Vb.net,User Accounts,你们能帮帮我吗。我想将管理员帐户重定向到管理员面板, 情况是: 我将以管理员帐户登录,它将重定向到管理员面板,如果不是,它将重定向到用户窗体 这是我的代码: Imports System.Data.OleDb Public Class Loginform Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter
Imports System.Data.OleDb
Public Class Loginform
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter
AcceptButton = loginbutton
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles loginbutton.Click
Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Administrator\Desktop\Users.mdb;")
Dim cmd As New OleDbCommand("SELECT [ID] FROM [Usertable] WHERE [usernameField] = username and [passwordField] = password", con)
Dim usernameparam As New OleDbParameter("username", usertxt.Text)
Dim passwordparam As New OleDbParameter("password", passtxt.Text)
cmd.Parameters.Add(usernameparam)
cmd.Parameters.Add(passwordparam)
cmd.Connection.Open()
Dim reader As OleDbDataReader = cmd.ExecuteReader()
If reader.HasRows Then
MsgBox("Login Successful", vbInformation, "Logged In.")
usertxt.Clear()
passtxt.Clear()
ElseIf usertxt.Text = Nothing And passtxt.Text = Nothing Then
MsgBox("Please input your correct Information.", vbExclamation, "Error!")
Else
MsgBox("Login Fail!" + vbCrLf + "Possible Problems:" + vbCrLf + "*Wrong Information(Password,Username)" + vbCrLf + "*Record is absent in database", vbCritical, "Try Again.")
usertxt.Clear()
passtxt.Clear()
End If
cmd.Connection.Close()
End Sub
我在这里没有看到任何表单…还有什么决定了管理员角色,我可以看到你只是在做一个查找,有其他类型的用户吗?是的,我没有包括表单,我想重点关注管理员帐户将重定向到其面板的部分。什么决定了管理员角色,还有什么其他类型的角色(如果有的话)?我已经问过这个问题了,但是你没有给我答案……我希望你能在某个专栏中了解这个用户所扮演的角色。