_RecordsetPtr pConn(__uuidof(Recordset)); |
_RecordsetPtr m_pRecordset; hr = m_pRecordset.CreateInstance("ADODB.Recordset"); |
属性/方法 | 描述 |
---|---|
Open ( const _variant_t & Source, const _variant_t & ActiveConnection, enum CursorTypeEnum CursorType, enum LockTypeEnum LockType, long Options ) | 执行查询 |
EOF | 游标是否到结尾, 已经没有更多记录 |
_variant_t GetCollect( const _variant_t & Index ) | 获取字段值 |
MoveNext() | 移到下一条记录 |
MoveFirst() | 移到首条记录 |
Delete( enum AffectEnum AffectRecords ) | 删除记录 |
AddNew() | 添加新记录 |
PutCollect ( const _variant_t & Index, const _variant_t & pvar ) | 设置字段值 |
Update() | 更新到数据库 |
Close() | 关闭记录 |
.Release() | 释放指针 |
Open ( const _variant_t & Source, const _variant_t & ActiveConnection, enum CursorTypeEnum CursorType, enum LockTypeEnum LockType, long Options ) |
参数 | 描述 | ||||||||
---|---|---|---|---|---|---|---|---|---|
Source | SQL 语句 | ||||||||
ActiveConnection | Connection 指针, 用法示例:_variant_t((IDispatch *)m_pConnection,true) | ||||||||
CursorType | 游标类型 adOpenUnspecified = -1,///不作特别指定 |
||||||||
LockType | adLockUnspecified = -1,///未指定 adLockReadOnly = 1,///只读记录集 adLockPessimistic = 2,悲观锁定方式。数据在更新时锁定其它所有动作,这是最安全的锁定机制 adLockOptimistic = 3,乐观锁定方式。只有在你调用Update方法时才锁定记录。在此之前仍然可以做数据的更新、插入、删除等动作 adLockBatchOptimistic = 4,乐观分批更新。编辑时记录不会锁定,更改、插入及删除是在批处理模式下完成。 |
||||||||
Options | 指示语句内容
|
Delete ( enum AffectEnum AffectRecords ) |
参数 | 描述 |
---|---|
AffectRecords | 删除范围 adAffectCurrent = 1, |
PutCollect ( const _variant_t & Index, const _variant_t & pvar ) |
参数 | 描述 |
---|---|
Index | 字段名或字段索引, 从 0 起 |
pvar | 字段值 |
参数 | 描述 |
---|---|