i am having this code on my log in button
Expand|Select|Wrap|Line Numbers
- Private Sub btnloginlogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnloginlogin.Click
- Try
- con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\Database1.accdb;Persist Security Info=False;")
- If con.State = ConnectionState.Closed Then
- con.Open()
- End If
- com = New OleDbCommand("SELECT * from tbllogin WHERE [User Name]='" & txtloginusname.Text & " ' And Password = ' " & txtloginpassword.Text & " ' And [Application/Role] = ' " & cmbloginrole.Text & " '", con)
- ds = New DataSet
- dap = New OleDbDataAdapter(com)
- dap.Fill(ds, "tbllogin")
- If con.State = ConnectionState.Open Then
- con.Close()
- End If
- If ds.Tables(0).Rows.Count() <> 0 Then
- If cmbloginrole.Text = "Administrator" Then
- AdministratorHomePage.Show()
- Me.Hide()
- Else
- MsgBox("UNAUTHORIZED USER")
- txtloginusname.Text = ""
- txtloginpassword.Text = ""
- cmbloginrole.Text = ""
- End If
- Else
- MsgBox("UNAUTHORIZED USER")
- txtloginusname.Text = ""
- txtloginpassword.Text = ""
- cmbloginrole.Text = ""
- End If
- Catch ex As Exception
- MsgBox(ex.Message)
- End Try
- End Sub
- End Class