VC++通过ODBC将数据导出到excel

CDatabase对象表示通过ODBC与数据源的连接,用于操作数据。文章介绍了如何使用CDatabase的OpenEx成员函数建立连接,并在完成操作后调用Close关闭连接。当创建CRecordset对象时,传入CDatabase对象指针以操作相连的数据源。
摘要由CSDN通过智能技术生成

CDatabase

A CDatabase object represents a connection to a data source, through which you can operate on the data source. A data source is a specific instance of data hosted by some database management system (DBMS). Examples include Microsoft SQL Server, Microsoft Access, Borland® dBASE®, and xBASE. You can have one or more CDatabase objects active at a time in your application.

Note   If you are working with the Data Access Objects (DAO) classes rather than the Open Database Connectivity (ODBC) classes, use class CDaoDatabase instead. For more information, see the articlesDatabase Topics (General) andDAO and MFC. Both articles are in Visual C++ Programmer's Guide.

To use CDatabase, construct a CDatabase object and call its OpenEx member function. This opens a connection. When you then construct CRecordset objects for operating on the connected data source, pass the recordset constructor a pointer to your CDatabase object. When you finish using the connection, call the Close member function and destroy the CDatabase object. Close closes any recordsets you have not closed previously.

For more information about CDatabase, see the articlesData Source (ODBC) andDatabase Topics (General) in Visual C++ Programmer's Guide.

#include <afxdb.h>

CDatabase Class Members

Data Members

m_hdbc Open Database Connectivity (ODBC) connection handle to a data source. Type HDBC.

Construction

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值