Solved

Set user permissions VB.net datagridview.

Posted on 2014-01-16
6
933 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 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Familiarize people with the process of utilizing SQL Server stored procedures 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 Micr…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

756 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