Solved

Set user permissions VB.net datagridview.

Posted on 2014-01-16
6
966 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 85
ID: 39786487
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
ID: 39786536
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
ID: 39786594
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:AnthonySmithMCP
ID: 39786607
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 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 39786658
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
ID: 39786666
Trying now...
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
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 …

687 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