Solved

Connecting Access table to read/ create/delete table using .NET in multi user environment

Posted on 2008-06-17
5
243 Views
Last Modified: 2008-07-17
I am connecting to acces table  to read some info from tbl_Test and will fill the dataset using command object.

I have few concern on this method...

1) The .NET will be used by multiple user so what will be the  best approach i should follow to avoid the common issues like he Microsoft Jet Database Engine cannot open the file ''\\svrPDM\master.mdb". It is opened in exclusive mode by another users. I do have some function which will
create and delete tables in master.mdb  

2) Client user network domain account will not have privileges to access the master.mdb file as it is parked in secured server, what i best way i can code the domain username
and password while perform reading, creating,deleting tables.  If possible ,how do i code in the connection string

Please share your thoughts.


       Dim conn As New OleDb.OleDbConnection
        Dim cmd As New OleDb.OleDbCommand
        Dim oleDBAdapter As New OleDb.OleDbDataAdapter
        Dim dsData As New DataSet
     
       conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data     Source=\\svrPDM\master.mdb;Mode=read;", "test", "1111")
        cmd.Connection = conn
        cmd.CommandText = "SELECT * FROM tbl_Test"
        oleDBAdapter.SelectCommand = cmd
        oleDBAdapter.Fill(dsData)
===========================================================================

0
Comment
Question by:nyeesg1984
  • 3
  • 2
5 Comments
 
LVL 24

Expert Comment

by:Jeff Certain
Comment Utility
You may want to consider using something other than Access as your backend database.

If cost is a concern, SQL Server Express may be worth considering.

You can also force Access to open in non-exclusive mode, but specifying "Exclusive = 0" as part of the JET engine connection string.
0
 

Author Comment

by:nyeesg1984
Comment Utility
Hi,

I  have no choice, have to use access 2000.

How do i connect to the access database using domain user name and password. , default windows login domain act doesnt have the privileges to  access the mdb, in other words i need to code this username/password along with connection string.


0
 
LVL 24

Accepted Solution

by:
Jeff Certain earned 500 total points
Comment Utility
Set the connection string to
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;Jet OLEDB:Database Password=MyDbPassword;Exclusive=0;

More options here: http://www.connectionstrings.com/?carrier=access
0
 

Author Comment

by:nyeesg1984
Comment Utility
Not sure whether writen down my question correctly.

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;Jet OLEDB:Database Password=MyDbPassword;Exclusive=0;

Assume MyDbPassword is the password for mdb file.

How do i add domain username/password to access mdb file.
0
 
LVL 24

Expert Comment

by:Jeff Certain
Comment Utility
Okay... so you need to impersonate another domain account.

Here's a lionk that explains how using Windows API calls. Not sure if there's a better way in .NET.
http://www.codeproject.com/KB/cs/User_Impersonation_in_Ne.aspx
0

Featured Post

Highfive Gives IT Their Time Back

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

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

7 Experts available now in Live!

Get 1:1 Help Now