Solved

Set user permissions VB.net datagridview.

Posted on 2014-01-16
6
839 Views
Last Modified: 2014-01-30
I'm creating a small application in VB that pulls its data from an MS Access database. The data goes to a datagridview in vb.net.

I want to know if its possible to create some sort of user account database in the application or in MS Access?

In the end I want to be able to have the user login and depending on the permissions give them read only or write access in the datagridview.
0
Comment
Question by:AnthonySmithMCP
  • 3
  • 2
6 Comments
 
LVL 84
Comment Utility
Access 2003 and earlier could use User Level Security. It can be tricky to setup and use, and for your purposes (controlling permissions to your .NET DataGridView control) would not be the best way to go.

Why not just add a User table, and then query that table as needed? For example:

tUsers
-------------
UserId
UserName
UserPassword
CanWrite

The "CanWrite" field would be used to determine if the user can write to the datagridview.

To validate the login, create a form to capture the user and pass, then compare that to the one stored in the database. If the passwords match, then also grab the value of CanWrite and store that in a variable named something like "bCanWrite"

When your form opens, do something like this:

YourDataGridView.ReadOnly = Not bCanWrite
0
 
LVL 1

Author Comment

by:AnthonySmithMCP
Comment Utility
Scott,

That is what I was thinking but I'm new to database programming. On thing that sticks out is what is stopping someone from going into that user account table and viewing the login/password information? Can a master password be set on the database?
0
 
LVL 14

Expert Comment

by:Matti
Comment Utility
hi

In old Access there where able to use DBEngine to open database against systemsm.mdw-file there where multiple accounts for users and permissions to individual objects in database. Thats obsolete now DAO. set NTFS permissions for users to use your application.
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 1

Author Comment

by:AnthonySmithMCP
Comment Utility
NTFS permissions is an option but not the best because some users are not domain users.

I was going with using a table in access but need to know if its possible to set a master password on the database to prevent users from just going to the table to view the usernames/passwords.
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
Comment Utility
Yes, you can set a database password. Not sure how you're creating the database, but if you're using Access 2010 then just open the database in Access, click the File option, and then use the "Encrypt with Password" feature.

Your connection string would be something like:

Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\myFolder\myAccessFile.accdb;
Jet OLEDB:Database Password=MyDbPassword;

See here: http://www.connectionstrings.com/access/
0
 
LVL 1

Author Comment

by:AnthonySmithMCP
Comment Utility
Trying now...
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now