473,545 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Full, simple, instructions for connecting my C# app to an Access database?

I'm new to this game. I can find my way around C# without any trouble,
and I've used Access, a little bit, in the past. Now a friend wants an
application of mine to read from his Access database. He's sent me the
..mdb file and a username and password, also an .mdw security file, and
I've tried to connect to it, using a couple of sample programs I found
on the web. Here's the critical code (<path>, <user>, and <password>
of course filling in for actual values):

static readonly string CONNECTION_STRI NG =
"Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=<path>.m db;user
id=<user>;passw ord=<password>" ;
....
connection_ = new OleDbConnection (Metadata.CONNE CTION_STRING);
connection_.Ope n();

Which gives me this result:
Error :Cannot start your application. The workgroup information file is missing or opened exclusively by another user.


I have tried to establish the mdw file he sent me as my MS Access
Database, using the ODBC Data Source Administrator, but it made no
difference.

I do not have MS Access installed on my development machine.

I would appreciate a detailed but minimal set of instructions to get
this working. Thanks in advance.

Nov 13 '05 #1
7 3555
Try just storing the MDW in the same folder as the database of the same
name. I presume your colleague gave you a valid userid and password that are
defined in the MDW; if not, you need to get those if the database has been
secured. Alas, very few of us in this newsgroup do much with any of the
C-family of languages, and many of us don't do any ADO.NET, or don't do
much.

I trust you have installed and have references to the ADO.NET library for
C#, or perhaps the "classic" ADO library. At least the classic ADO library
is in the "MDAC" from Microsoft. If you don't have it already, download the
most current version and install it.

Not really pertinent to your particular issues, but just for the record,
Access is the user interface and development tool. The default database
engine used with Access is Jet. What you have is a Jet database -- those are
often called "Access databases". But Access can be used as a front-end to
any ODBC compliant database, and with ADO, to any database that has an ADODB
data provider.

You'll have a better chance of getting the answers you need if you will
visit a newsgroup that is devoted to ADO.NET or C# database access. I
suspect you'll be able to find one that is suitable at the free newsserver
news.microsoft. com.

Larry Linson
Microsoft Access MVP

<ca***********@ gmail.com> wrote in message
news:11******** *************@g 49g2000cwa.goog legroups.com...
I'm new to this game. I can find my way around C# without any trouble,
and I've used Access, a little bit, in the past. Now a friend wants an
application of mine to read from his Access database. He's sent me the
.mdb file and a username and password, also an .mdw security file, and
I've tried to connect to it, using a couple of sample programs I found
on the web. Here's the critical code (<path>, <user>, and <password>
of course filling in for actual values):

static readonly string CONNECTION_STRI NG =
"Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=<path>.m db;user
id=<user>;passw ord=<password>" ;
...
connection_ = new OleDbConnection (Metadata.CONNE CTION_STRING);
connection_.Ope n();

Which gives me this result:
Error :Cannot start your application. The workgroup information file is
missing or opened exclusively by another user.
I have tried to establish the mdw file he sent me as my MS Access
Database, using the ODBC Data Source Administrator, but it made no
difference.

I do not have MS Access installed on my development machine.

I would appreciate a detailed but minimal set of instructions to get
this working. Thanks in advance.

Nov 13 '05 #2
Thanks, Larry.

I tried naming the .mdw file the same as the .mdb (it was already in
the same folder), to no avail. Thank you for the terminological
clarification, too. I'll go ask on another newsgroup.

--Carl

Nov 13 '05 #3
ca***********@g mail.com wrote in
news:11******** *************@z 14g2000cwz.goog legroups.com:
I tried naming the .mdw file the same as the .mdb (it was already
in the same folder), to no avail. Thank you for the
terminological clarification, too. I'll go ask on another
newsgroup.


Um, you *never* want the MDW and the MDB file to have the same name
if they are stored in the same folder. The reason is that, given the
fact that an MDW is just a special kind of MDB, when it's in use,
there's a recordlocking file, *.LDB, with "*" being the name of the
MDB/MDW. If you've got the same file name for both, you end up with
a collision on the LDB file.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #4
<ca***********@ gmail.com> wrote in message
news:11******** *************@g 49g2000cwa.goog legroups.com...
I'm new to this game. I can find my way around C# without any trouble,
and I've used Access, a little bit, in the past. Now a friend wants an
application of mine to read from his Access database. He's sent me the
.mdb file and a username and password, also an .mdw security file, and
I've tried to connect to it, using a couple of sample programs I found
on the web. Here's the critical code (<path>, <user>, and <password>
of course filling in for actual values):

static readonly string CONNECTION_STRI NG =
"Provider=Micro soft.Jet.OLEDB. 4.0;Data Source=<path>.m db;user
id=<user>;passw ord=<password>" ;
...
connection_ = new OleDbConnection (Metadata.CONNE CTION_STRING);
connection_.Ope n();

Which gives me this result:
Error :Cannot start your application. The workgroup information file is
missing or opened exclusively by another user.


I have tried to establish the mdw file he sent me as my MS Access
Database, using the ODBC Data Source Administrator, but it made no
difference.

I do not have MS Access installed on my development machine.

I would appreciate a detailed but minimal set of instructions to get
this working. Thanks in advance.


You don't seem to have specified which mdw file to use. As part of the
connection string you could have:

"Jet OLEDB:System database=C:\MyF older\MyWorkgro up.mdw"

Have a look at http://support.microsoft.com/kb/q191754/ for examples. Also
note that whether you are using ADO or ADO.NET one of the few things left
unchanged is the format of the connection string.

Nov 13 '05 #5
"David W. Fenton" <dX********@bwa y.net.invalid> wrote in message
news:Xn******** *************** ***********@24. 168.128.86...
ca***********@g mail.com wrote in
news:11******** *************@z 14g2000cwz.goog legroups.com:
I tried naming the .mdw file the same as the .mdb (it was already
in the same folder), to no avail. Thank you for the
terminological clarification, too. I'll go ask on another
newsgroup.


Um, you *never* want the MDW and the MDB file to have the same name
if they are stored in the same folder. The reason is that, given the
fact that an MDW is just a special kind of MDB, when it's in use,
there's a recordlocking file, *.LDB, with "*" being the name of the
MDB/MDW. If you've got the same file name for both, you end up with
a collision on the LDB file.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc

A collision sounds dangerous, damaging, if not fatal. Have you tried this
yourself and found what damage is caused. Out of curiosity, I tried this
with AccXP and found that I could edit the database as normal. A single ldb
file is created with two entries per login.
Not that this is desirable, nor have I ever previously used the same
name/location for both files, but it does give more detail than the answer
"don't do this or there'll be a collision". Or perhaps you know further
details of the effects...


Nov 13 '05 #6
Thanks, Justin,

That worked beautifully. This is exactly the piece of information I
was missing. For the record, the mdw and mdb names were the same in
this case and it worked fine.

Peace,
--Carl

Nov 13 '05 #7
"Justin Hoffman" <j@b.com> wrote in
news:d9******** **@nwrdmz01.dmz .ncs.ea.ibs-infra.bt.com:
"David W. Fenton" <dX********@bwa y.net.invalid> wrote in message
news:Xn******** *************** ***********@24. 168.128.86...
ca***********@g mail.com wrote in
news:11******** *************@z 14g2000cwz.goog legroups.com:
I tried naming the .mdw file the same as the .mdb (it was
already in the same folder), to no avail. Thank you for the
terminological clarification, too. I'll go ask on another
newsgroup.


Um, you *never* want the MDW and the MDB file to have the same
name if they are stored in the same folder. The reason is that,
given the fact that an MDW is just a special kind of MDB, when
it's in use, there's a recordlocking file, *.LDB, with "*" being
the name of the MDB/MDW. If you've got the same file name for
both, you end up with a collision on the LDB file.


A collision sounds dangerous, damaging, if not fatal. Have you
tried this yourself and found what damage is caused. Out of
curiosity, I tried this with AccXP and found that I could edit the
database as normal. A single ldb file is created with two entries
per login. Not that this is desirable, nor have I ever previously
used the same name/location for both files, but it does give more
detail than the answer "don't do this or there'll be a collision".
Or perhaps you know further details of the effects...


No, I've never done it. It makes no sense whatsoever to try it.

Either give the MDW a different name or put it in a different
folder.

I vote for changing the name, since users basically never know
anything about it. My policy on this is if the app is called
XYZ.mdb, then the MDW is XYZUsers.mdw.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5483
by: John Morgan | last post by:
I have Enterprise Manager on my local machine. For the last twelve months it has been connecting without problem to my online SQL Server database provided by my ISP. Three weeks ago the ISP applied some sort of extra security arrangements to their SQL Server to allow access only through port 1433. they have told me to configure an alias...
3
6763
by: Simple Man | last post by:
We have a citrix server that users will be signing into from a remote location. One application is an Access database. Right now, lan users are using the Access 2003 runtime to run these applications. Installing the runtime on the citrix server(s) isn't a big deal. The catch is, I want to install a copy of the full version of Access so...
12
2757
by: Ann Marinas | last post by:
Hi all, I would like to ask for some help regarding separating the asp.net webserver and the sql server. I have created an asp.net application for a certain company. Initially, we installed both the iis and sql server in a single machine. Not too long ago, the machine had some hardware problems, and management has decided to purchase new...
2
3502
by: SpoonfulofTactic | last post by:
I am building a Blog for my own person use, and I would like to be able to use unicode characters outside the range of the ascii set. However, when I use odbc to access table data, Access returns question marks in the place of the character data. Is there any way to set the default encoding of access to "UTF-8," or, alternatively, is there...
2
3226
by: francois1 | last post by:
I am running a website with a SQL Server database attached. My transaction logs are full and my hosting co. won't allocate more disk space for me. I need to delete my database transaction logs and asume I will need to run an SQL script to do this. Problem: I do not have MS Enterprise Manager of any database utility on my website apart...
5
2511
by: yoyo | last post by:
Just to help somebody else if they are looking, we wasted 2 hours last night trying to figure out the problem. (With a manager over our shoulder) We upgraded our 8.1 FP11 instance to FP13. Instructions first say that there are no instruction changes from FP11 to FP13. Great, so we install FP13, run all the binds on the server like it says,...
2
1379
by: Andy.I | last post by:
Hi I'm working on a little database application, and mst be cosnidered a newbie. What are the recomended way of making the database? Is it by adding a database file directy in my vb solution, or making a database on my SQL server and connecting to this? If I choose add item from "solution explorer" and adds a SQL Server database this way,...
3
1477
by: Blarneystone | last post by:
Ok, I've got a simple access 97 db. named S_tracking.mdb It has two tables 1- Jobs 2- Employees I've set up the references: Imports System.Data.OleDb Imports System.IO Imports System.data
0
7473
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7408
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7661
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7815
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7433
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
4949
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3458
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1020
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.