Solved

Visual C# Database connection string

Posted on 2006-07-08
6
2,557 Views
Last Modified: 2012-08-14
Can some1 plz tell wht wud be the connection string for connecting to a MS Access Database using Visual C# would be.
For some reason I am getting confused with the exact syntax.

Examples of strings would be appreciated
thx
0
Comment
Question by:jhav1594
[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
6 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 125 total points
ID: 17065902
Lots of good information about this and other connection strings at:

http://www.connectionstrings.com/

and also

http://www.dofactory.com/Connect/Connect.aspx#_self9
0
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 125 total points
ID: 17066101
In its basic form:

      OleDbConnection cn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=yourdatabase.mdb;");
0
 
LVL 5

Assisted Solution

by:Davidshc76
Davidshc76 earned 125 total points
ID: 17066575
Copy the following Connection string to the Connection string Property of your oleDBConnection Object.. Don't forget to change your Datasource (The path of your Database, and the Username and Password)..

Provider=Microsoft.Jet.OLEDB.4.0;Password="";User ID=Admin;Data Source=DBName.mdb;Mode=ReadWrite|Share Deny None;Extended Properties="";Jet OLEDB:System database="";Jet OLEDB:Registry Path="";Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=5;Jet OLEDB:Database Locking Mode=1;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False

Make sure that AccessXP is not opened while you are running your application..

Good Luck!
0
 
LVL 15

Assisted Solution

by:Raisor
Raisor earned 125 total points
ID: 17069656
Hi,

I'd suggest the following article at Microsoft: http://msdn2.microsoft.com/en-us/library/system.data.common.dbconnectionstringbuilder.aspx

... it'll give you some kind of a variety to chose what you're looking for!


Best regards,
Raisor
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Starting up a Project

707 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