Solved

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

Posted on 2008-06-17
5
244 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Connect to a database from Excel using JDBC instead of ODBC 3 47
Copy/Clone an object. 9 29
Get Top Visible Row of Datagridview 6 26
Help with LINQ and XML 10 25
This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

948 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

20 Experts available now in Live!

Get 1:1 Help Now