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 (); |