Solved

Visual C# Database connection string

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

758 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

22 Experts available now in Live!

Get 1:1 Help Now