Solved

Set user permissions VB.net datagridview.

Posted on 2014-01-16
6
916 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
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
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
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 84

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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
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 …

808 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