王朝百科
分享
 
 
 

CDatabase

王朝百科·作者佚名  2010-06-20  
宽屏版  字体: |||超大  

CDatabase详解CDatabase对象表示到数据源的连接,通过它可以操作数据源。数据源是位于一些数据库管理系统(DBMS)的数据的指定实例,包括MicrosoftSQL Server,Microsoft Access,Borland dBASE和xBASE。在应用中可以同时使一个或多个CDatabase对象活动。

注意:

如果在处理数据访问对象(DAO)类而不是开放数据库连接(ODBC)类,可使用类CDaoDatabase。有关的更多信息,请参阅联机文档“Visual C++程序员指南”中的“数据库主题(通用)”与“DAO和MFC”。

为使用CDatabase,构造一个CDatabase对象并调用它的OpenEx成员函数。这打开了一个连接。在接着构造CRecordset对象以操纵连接的数据源时,向CDatabase对象传递记录集构造程序指针。完成使用连接时调用Close成员函数并销毁CDatabase对象。Close关闭以前没有关闭的任何记录集。

Data Membersm_hdbc

Open Database Connectivity (ODBC) connection handle to a data source. TypeHDBC.

Construction

CDatabase

Constructs aCDatabaseobject. You must initialize the object by callingOpenExorOpen.

Open

Establishes a connection to a data source (through an ODBC driver).

OpenEx

Establishes a connection to a data source (through an ODBC driver).

Close

Closes the data source connection.

Database Attributes

GetConnect

Returns the ODBC connect string used to connect theCDatabaseobject to a data source.

IsOpen

Returns nonzero if theCDatabaseobject is currently connected to a data source.

GetDatabaseName

Returns the name of the database currently in use.

CanUpdate

Returns nonzero if theCDatabaseobject is updatable (not read-only).

CanTransact

Returns nonzero if the data source supports transactions.

SetLoginTimeout

Sets the number of seconds after which a data source connection attempt will time out.

SetQueryTimeout

Sets the number of seconds after which database query operations will time out. Affects all subsequent recordsetOpen,AddNew,Edit, andDeletecalls.

GetBookmarkPersistence

Identifies the operations through which bookmarks persist on recordset objects.

GetCursorCommitBehavior

Identifies the effect of committing a transaction on an open recordset object.

GetCursorRollbackBehavior

Identifies the effect of rolling back a transaction on an open recordset object.

Database Operations

BeginTrans

Starts a “transaction” — a series of reversible calls to theAddNew,Edit,Delete, andUpdatemember functions of classCRecordset— on the connected data source. The data source must support transactions forBeginTransto have any effect.

BindParameters

Allows you to bind parameters before callingCDatabase::ExecuteSQL.

CommitTrans

Completes a transaction begun byBeginTrans. Commands in the transaction that alter the data source are carried out.

Rollback

Reverses changes made during the current transaction. The data source returns to its previous state, as defined at theBeginTranscall, unaltered.

Cancel

Cancels an asynchronous operation or a process from a second thread.

ExecuteSQL

Executes an SQL statement. No data records are returned.

所需头文件:#include <afxdb.h>

Database Overridables

OnSetOptions

Called by the framework to set standard connection options. The default implementation sets the query timeout value. You can establish these options ahead of time by callingSetQueryTimeout.

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
中国古代四大美女:背后隐藏惊人秘密
 女性   2025-06-20
如何用java替换看不见的字符比如零宽空格&#8203;十六进制U+200B
 干货   2023-09-10
网页字号不能单数吗,网页字体大小为什么一般都是偶数
 干货   2023-09-06
java.lang.ArrayIndexOutOfBoundsException: 4096
 干货   2023-09-06
Noto Sans CJK SC字体下载地址
 干货   2023-08-30
window.navigator和navigator的区别是什么?
 干货   2023-08-23
js获取referer、useragent、浏览器语言
 干货   2023-08-23
oscache遇到404时会不会缓存?
 干货   2023-08-23
linux下用rm -rf *删除大量文件太慢怎么解决?
 干货   2023-08-08
刀郎新歌破世界纪录!
 娱乐   2023-08-01
js实现放大缩小页面
 干货   2023-07-31
生成式人工智能服务管理暂行办法
 百态   2023-07-31
英语学习:过去完成时The Past Perfect Tense举例说明
 干货   2023-07-31
Mysql常用sql命令语句整理
 干货   2023-07-30
科学家复活了46000年前的虫子
 探索   2023-07-29
英语学习:过去进行时The Past Continuous Tense举例说明
 干货   2023-07-28
meta name="applicable-device"告知页面适合哪种终端设备:PC端、移动端还是自适应
 干货   2023-07-28
只用css如何实现打字机特效?
 百态   2023-07-15
css怎么实现上下滚动
 干货   2023-06-28
canvas怎么画一个三角形?
 干货   2023-06-28
canvas怎么画一个椭圆形?
 干货   2023-06-28
canvas怎么画一个圆形?
 干货   2023-06-28
canvas怎么画一个正方形?
 干货   2023-06-28
中国河南省郑州市金水区蜘蛛爬虫ip大全
 干货   2023-06-22
javascript简易动态时间代码
 干货   2023-06-20
 
>>返回首页<<
 
 
静静地坐在废墟上,四周的荒凉一望无际,忽然觉得,凄凉也很美
© 2005- 王朝网络 版权所有