Solved

Visual C# Database connection string

Posted on 2006-07-08
6
2,546 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
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
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 …

821 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