Solved

Visual C# Database connection string

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

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

This article will show, step by step, how to integrate R code into a R Sweave document
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

867 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

18 Experts available now in Live!

Get 1:1 Help Now