c++操作sqlserver或者access数据库可以导入msado15.dll来实现,将会根据你import时的参数生成msado15.tlh和msado15.tli文件,这两个文件对msado15.dll中的COM组件类进行的smart pointer的封装。
对于tlh和tli如何封装COM组件类为C++类,我举一个例子,ADO中的Connection类的例子。
在msado15.dll中有一个COM组件类:
struct __declspec(uuid("00000550-0000-0010-8000-00aa006d2ea4"))
_Connection : Connection15
{
//
// Wrapper methods for error-handling
//
HRESULT Cancel ( );
//
// Raw methods provided by interface
//
virtual HRESULT __stdcall raw_Cancel ( ) = 0;
};
_Connection : Connection15
{
//
// Wrapper methods for error-handling
//
HRESULT Cancel ( );
//
// Raw methods provided by interface
//
virtual HRESULT __stdcall raw_Cancel ( ) = 0;
};
该