Results 1 to 2 of 2

Thread: Register form- What to add security levels

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2015
    Posts
    3

    Register form- What to add security levels

    I just need another if statement for the security level which is inside the register form, its got nothing to do with the login form as all users can access everything but only users with admin level can only register staff so I don't think I will needs security level for the Login form as everyone is able to access all the features off the application.

    I just need a basic if else statement added to my register form with security levels shows that only admin can register users. Could anybody help me how to add an is statement or anything else for security levels as only admin can register staff but nobody else.

    Code:
    Imports System.Data.OleDb
    
    Public Class RegisterForm
    
    
        Private Sub cmdRegister_Click(sender As Object, e As EventArgs) Handles cmdRegister.Click
            Try
    
                If txtUser.Text = "" Or txtPassword.Text = "" Then
    
                    MsgBox("please Enter Username Or Password")
                    Exit Sub
                End If
                If txtUser.Text = "john" And txtPassword.Text = "123" Then
                    MsgBox("You Have Sucessfully Registered For The Deep Blue System")
    
                End If
    
                Dim usernme, passwrd As String
                usernme = txtUser.Text
                passwrd = txtPassword.Text
                Dim conn As New System.Data.OleDb.OleDbConnection
                conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\DeepBlueTables.mdb"
    
                conn.Open()
                Dim sqlQry As String = "INSERT INTO [User] ([UserName], [Password]) VALUES (@txtUser, @txtPassword)"
                Using cmd As New OleDbCommand(sqlQry, conn)
    
    
                    cmd.Parameters.AddWithValue("@txtUser", txtUser.Text)
                    cmd.Parameters.AddWithValue("@txtPassword", txtPassword.Text)
                    cmd.ExecuteNonQuery()
                End Using
    
            Catch ex As Exception
    
    
                LoginForm.Show()
    
    
    
            End Try
            MessageBox.Show("You Have Sucessfully Registered For The Deep Blue System")
            LoginForm.Show()
    
    
    
        End Sub
    End Class
    Attached Images Attached Images  

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,501

    Re: Register form- What to add security levels

    Thread moved from the FAQ forum, which is not the place to post your questions.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width