Database connection string-Microsoft Access

Source: Internet
Author: User
Tags dsn

Database connection string-Microsoft Access

ODBC DSN

// ODBC DSN

 

Using system. Data. ODBC;

 

Odbcconnection conn = new odbcconnection ();

Conn. connectionstring = "DSN = dsnname ";

Conn. open ();

 

ODBC -- standard security

// ODBC -- standard security

 

Using system. Data. ODBC;

 

Odbcconnection conn = new odbcconnection ();

Conn. connectionstring =

"Driver = {Microsoft Access Driver (*. mdb)};" +

"DBQ = C:/mypath/mydb. mdb;" +

"Uid = admin; Pwd = ;";

Conn. open ();

 

ODBC -- Workgroup (System database)

// ODBC -- Workgroup (System database)

 

Using system. Data. ODBC;

 

Odbcconnection conn = new odbcconnection ();

Conn. connectionstring =

"Driver = {Microsoft Access Driver (*. mdb)};" +

"DBQ = C:/mypath/mydb. mdb;" +

"Systemdb = C:/mypath/mydb. MDW ;";

Conn. open ();

 

ODBC -- exclusive use

// ODBC -- exclusive use

 

Using system. Data. ODBC;

 

Odbcconnection conn = new odbcconnection ();

Conn. connectionstring =

"Driver = {Microsoft Access Driver (*. mdb)};" +

"DBQ = C:/mypath/mydb. mdb;" +

"Exclusive = 1 ;";

"Uid = admin; Pwd = ;";

Conn. open ();

 

Oledb with MS jet -- standard security

// Oledb with MS jet -- standard security

 

Using system. Data. oledb;

 

Oledbconnection conn = new oledbconnection ();

Conn. connectionstring =

"Provider = Microsoft. Jet. oledb.4.0;" +

"Data Source = C:/mypath/mydb. mdb;" +

"User ID = admin;" +

"Password = ";

Conn. open ();

 

Oledb with MS jet -- Workgroup (System database)

// Oledb with MS jet -- Workgroup (System database)

 

Using system. Data. oledb;

 

Oledbconnection conn = new oledbconnection ();

Conn. connectionstring =

"Provider = Microsoft. Jet. oledb.4.0;" +

"Data Source = C:/mypath/mydb. mdb;" +

"System database = C:/mypath/mydb. MDW ;";

Conn. open ();

 

Oledb with MS jet -- with Password

// Oledb with MS jet -- with Password

 

Using system. Data. oledb;

 

Oledbconnection conn = new oledbconnection ();

Conn. connectionstring =

"Provider = Microsoft. Jet. oledb.4.0;" +

"Data Source = C:/mypath/mydb. mdb;" +

"Database Password = secret ;"

Conn. open ();

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.