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
Solved

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

Posted on 2008-06-17
5
247 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
ID: 21811842
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
ID: 21818668
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
ID: 21818765
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
ID: 21819781
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
ID: 21821117
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

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…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

789 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