| | |
login as admin , HOW !?
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jun 2008
Posts: 4
Reputation:
Solved Threads: 0
hi ,
I'm using VB.net :
I want to create login and check if the user is admin or not from the table in the database .
in my database i have table(Log_in) contains : user name , Password , User Type .
I create Login Form :
...
The Problem is the user Type its only work correctly with admin ,
Could you help me , please ?
I'm using VB.net :
I want to create login and check if the user is admin or not from the table in the database .
in my database i have table(Log_in) contains : user name , Password , User Type .
I create Login Form :
vbnet Syntax (Toggle Plain Text)
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click Dim vCon As New SqlConnection vCon.ConnectionString = "..... " Dim vSelectCommand As New SqlCommand Dim myCommand As SqlCommand myCommand = New SqlCommand("SELECT [User_Name],[Password],[User_Type] FROM Log_in WHERE [User_Name] = @UserName AND [Password] = @UserPassword AND [User_Type] = @UserType", vCon) Dim uName As New SqlParameter("@UserName", SqlDbType.NVarChar) Dim uPassword As New SqlParameter("@UserPassword", SqlDbType.NVarChar) Dim uType As New SqlParameter("@UserType", SqlDbType.NVarChar) uName.Value = UsernameTextBox.Text uPassword.Value = PasswordTextBox.Text "uType.Value = "admin myCommand.Parameters.Add(uName) myCommand.Parameters.Add(uPassword) myCommand.Parameters.Add(uType) myCommand.Connection.Open() Dim myReader As SqlDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConne ction) Dim Login As Object = 0 If myReader.HasRows Then myReader.Read() Login = myReader(Login) End If If Login = Nothing Then MessageBox.Show("sorry ....") Else ' Administrator Roles : If uType.Value = "admin" Then myCommand.Parameters.Add(uType) MessageBox.Show("User identified as Admin, logging in") Form1.Show() Form1.SystemToolStripMenuItem.Enabled = True Form1.ReportToolStripMenuItem.Enabled = True Else If uType.Value = "user" Then myCommand.Parameters.Add(uType) MessageBox.Show("Login successful") Form1.Show() Form1.SystemToolStripMenuItem.Enabled = False Form1.ReportToolStripMenuItem.Enabled = False End If End If '............ Me.Hide() End If End Sub
...
The Problem is the user Type its only work correctly with admin ,
Could you help me , please ?
Last edited by cscgal; Oct 15th, 2008 at 11:26 am. Reason: Added code tags
"SELECT [User_Name],[Password],[User_Type] FROM Log_in WHERE [User_Name] = @UserName AND [Password] = @UserPassword " and then check which User_Type this user has. I won't correct the rest of your code, you can surely do it yourself. Teme64 @ Windows Developer Blog
![]() |
Similar Threads
- bypass login password win xp (Windows NT / 2000 / XP)
- Website Login (ASP.NET)
- IBM A21M Password for safe admin (Troubleshooting Dead Machines)
- Limited hacking Admin... (IT Professionals' Lounge)
- Windows XP Pro login problems (Windows NT / 2000 / XP)
- Simple ASP.Net Login Page (Using VB.Net) (ASP.NET)
- Windows Wont Load Past Login (Windows NT / 2000 / XP)
- Cannot Login to Mac (OS X)
Other Threads in the VB.NET Forum
- Previous Thread: making a banking project
- Next Thread: How do you access pictureboxes as arrays
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2005 2008 access account application array arrays basic beginner browser button buttons center checkbox client code convert cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic eclipse excel fade filter forms ftp generatetags gridview html images inline input insert intel internet lib listview mobile monitor net objects open panel passingparameters pdf picturebox port position print printing problem read remove save searchvb.net select serial settings shutdown soap sorting sqlserver survey table temperature textbox timer timespan transparency trim update user validation vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web webbrowser winforms wpf wrapingcode year





