database access

26c9b1c8.png 2009年4月15日星期三 哈哈,10年前的技术,目前我还在使用 Access Database method with VC++,按时间顺序排列目前最后的技术是ADO 1.ODBC API; 2.MFC ODBC类; 3.MFC DAO类;(数据访问对象) 访问access数据库性能最好 4.MFC的OLE/DB 5.ActiveX数据对象(ADO)

As of Visual C++ .NET, the Visual C++ environment and wizards no longer support DAO (although the DAO classes are included and you can still use them). Microsoft recommends that you use OLE DB Templates or ODBC for new projects. You should only use DAO in maintaining existing applications.

CString CApp1Set::GetDefaultConnect()
{
return "ODBC;DSN=afx;Trusted_Connection=Yes;";
}

ODBC

ODBC is an interface to access database management systems (DBMS). ODBC was developed by SQL Access Group in 1992 at a time, when there were no standard medium to communicate between a database and an application. It does not depend on a specific programming language or a database system or an operating system. Programmers can use ODBC interface to write applications that can query data from any database, regardless of the environment it is running on or the type of DBMS it uses.

ADO

ADO is a collection of COM (Component Object Mode) objects that act as an interface for accessing data in data sources. ADO was developed in 1996 by Microsoft as a part of the Microsoft Data Access Components (MDAC). ADO forms a middleware layer between applications written in some programming language and OLE DB (a data API developed by Microsoft and the successor to ODBC). Programmers can use ADO to access data without knowing the underlying implementation details of the database. Although you are not required to know any SQL to use ADO, you can certainly execute SQL statements using it.

OLEDB

ODBC vs ADO

ODBC is an open interface, which can be used by any application to communicate with any database system, while ADO is a wrapper around OLE DB (which is the successor to ODBC). If the database does not support OLE (non-OLE environments) then ODBC is the best choice. If the environment is non-SQL, then you have to use ADO (because ODBC works only with SQL). If interoperable database components are required, then ADO needs to be used instead of ODBC. However, for 16-bit data accessing ODBC is the only option (ADO does not support 16-bit). Finally, ADO is the best choice for connecting to multiple databases at once (ODBC can connect to only one database at a time).

Library

https://github.com/SOCI/soci