当前位置: 首页 > 网络学院 > 服务端脚本教程 > ADO > ADO WillExecute 与 ExecuteComp

ADO
ADO介绍
ADO数据库连接
ADO记录集
ADO显示记录
ADO查询语句
ADO记录排序
ADO添加记录
ADO更新记录
ADO删除记录
ADO演示
ADO提升执行速度
ADO Command对象
ADO Connection对象
ADO Error
ADO Field
ADO Parameter
ADO 属性
ADO Record
ADO Recordset
ADO Stream

ADO WillExecute 与 ExecuteComp


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 417 ::
收藏到网摘: n/a

An event is a subroutine that can be called automatically after a specific operation has occurred.
事件就是在一个具体操作发生之后自动请求的一个字程序。

  • The WillExecute event can be fired just before a call to objcomm.Execute, objconn.Execute, or objrs.Open.
    WillExecute 事件仅可以在请求objcomm.Execute、objconn.Execute或objrs.Open.之前激发
  • The ExecuteComplete event can be fired after a call to objcomm.Execute, objconn.Execute, objrs.Open, objrs.Requery, or objrs.NextRecordset is completed.
    ExecuteComplete 事件可以在objcomm.Execute、objconn.Execute、objrs.Open、objrs.Requery或objrs.NextRecordset处理完毕以后激发

Syntax
语法

WillExecute src,cursortyp,locktyp,options,
status,objcomm,objrs,objconn
ExecuteComplete recaffected,objerror,status,
objcomm,objrs,objconn

Parameter参数 Description描述
src A string that contains an SQL command or a stored procedure name
指定包含一个SQL指令或一个已存程序名称的字符串
cursortyp Specifies the type of cursor to be used. One of the CursorTypeEnum values
指定使用的指针类型。它可以是CursorTypeEnum中的一个值
locktyp Specifies the type of lock to be used. One of the LockTypeEnum values
指定使用的锁的类型。它可以是LockTypeEnum中的一个值
options One or more of the CommandTypeEnum or ExecuteOptionEnum values
一个或多个CommandTypeEnum 或 ExecuteOptionEnum值
recaffected The number of records affected by the execution
指定需要执行操作的记录数量
objerror An Error object that contains the errors that occurred
包含所发生的错误的Error对象

Note: The EventStatusEnum value must be set to adStatusErrorsOccurred to create the Error object
注意:EventStatusEnum值必须被设置为adStatusErrorsOccurred以创建Error[错误]对象

status An EventStatusEnum value
指定一个EventStatusEnum值
objcomm For WillExecute: Set to the Command object that was executed or to Nothing
对于WillExecute:设置需要执行的Command[指令]对象或不设置任何值

For ExecuteComplete: The Command object that was executed
对于ExecuteComplete:需要执行的指令对象

objrs For WillExecute: Set to the Recordset object that resulted from the execution of the command or to Nothing
对于WillExecute:设置通过执行指令对象所产生的Recordset[记录集]对象中不设置任何值

For ExecuteComplete: The Recordset object that is the result of the executed command
对于ExecuteComplete:将其设置在指令执行产生的Recordset对象中

objconn The Connection object that is associated with the execution of the command
指定与指令的执行相关的连接对象


CursorTypeEnum Values

Specifies the type of cursor used in a Recordset object.
指定在Recordset对象中的指针类型

Constant常量 Value值 Description描述
adOpenUnspecified -1 Does not specify the type of cursor.
不指定指针类型
adOpenForwardOnly 0 Default. Uses a forward-only cursor. Identical to a static cursor, except that you can only scroll forward through records. This improves performance when you need to make only one pass through a Recordset.
仅向前移动指针,默认值。除了只能在记录中向前滚动外,与静态指针相同。当只需要在记录集中单向移动时,使用它可提高性能。(顾名思义,这种指针只能向前移动。然而,由于这种指针功能有限,将它用于系统资源时是非常有效的。)
adOpenKeyset 1 Uses a keyset cursor. Like a dynamic cursor, except that you can't see records that other users add, although records that other users delete are inaccessible from your Recordset. Data changes by other users are still visible.
键集指针。尽管从您的记录集不能访问其他用户删除的记录,但除无法查看其他用户添加的记录外,键集指针与动态指针相似。仍然可以看见其他用户更改的数据。(KeySet指针允许你看见自它创建起其他用户所做的修改,然而你却不能看到其他用户增加或删除的记录。)
adOpenDynamic 2 Uses a dynamic cursor. Additions, changes, and deletions by other users are visible, and all types of movement through the Recordset are allowed, except for bookmarks, if the provider doesn't support them.
动态指针。可以看见其他用户所作的添加、更改和删除。允许在记录集中进行所有类型的移动,但不包括提供者不支持的书签操作。(此类型的指针功能强大同时也是耗费系统资源最多的指针。Dynamic指针可以看到他们保存记录集合的所有变化。使用Dynamic指针的用户可以看到其他用户所做的编辑、增加、删除。如果数据提供者允许这种类型的指针,那么它是通过每隔一段时间从数据源重取数据来支持这种可视性的。毫无疑问这会需要很多的资源。 )
adOpenStatic 3 Uses a static cursor. A static copy of a set of records that you can use to find data or generate reports. Additions, changes, or deletions by other users are not visible.
动态指针。可以看见其他用户所作的添加、更改和删除。允许在记录集中进行所有类型的移动,但不包括提供者不支持的书签操作。(此类型的指针功能强大同时也是耗费系统资源最多的指针。Dynamic指针可以看到他们保存记录集合的所有变化。使用Dynamic指针的用户可以看到其他用户所做的编辑、增加、删除。如果数据提供者允许这种类型的指针,那么它是通过每隔一段时间从数据源重取数据来支持这种可视性的。毫无疑问这会需要很多的资源。 )


LockTypeEnum Values

Constant常量 Value值 Description描述
adLockUnspecified -1 Does not specify a type of lock. For clones, the clone is created with the same lock type as the original.
不指定锁类型。通过它可以创建一个与原来类型相同的锁
adLockReadOnly 1 Indicates read-only records. You cannot alter the data.
默认值,只读。无法更改数据。(这是RecodSet的默认值,如果你把锁定的方式设为该值,那么你将不能更新 Recordset。)
adLockPessimistic 2 Indicates pessimistic locking, record by record. The provider does what is necessary to ensure successful editing of the records, usually by locking records at the data source immediately after editing.
保守式记录锁定(逐条)。提供者执行必要的操作确保成功编辑记录,通常采用编辑时立即锁定数据源的记录的方式。(如果设置为此类锁定,记录被锁定,且只有在编辑开始到将记录更新的提交给数据提供者这段时间内进行编辑的用户才可以访问! )
adLockOptimistic 3 Indicates optimistic locking, record by record. The provider uses optimistic locking, locking records only when you call the Update method.
开放式记录锁定(逐条)。提供者使用开放式锁定,只在调用 Update 方法时锁定记录。(只有在将数据提交给数据提供者的那一瞬间才把记录锁定。)
adLockBatchOptimistic 4 Indicates optimistic batch updates. Required for batch update mode.
开放式批更新。用于与立即更新模式相反的批更新模式。(设定为这种类型的锁定制式将被称为批量更新模式的RecordSet。 可以加快更新RecordSet修改数据的速度,但因为同时更新多个记录,它也会恶化与并发访问相关的问题! )


CommandTypeEnum Values

Constant常量 Value值 Description描述
adCmdUnspecified -1 Does not specify the command type argument.
不指定指令类型自变量
adCmdText 1 Evaluates CommandText as a textual definition of a command or stored procedure call.
指示提供者应该将Source作为命令的文本定义来计算
adCmdTable 2 Evaluates CommandText as a table name whose columns are all returned by an internally generated SQL query.
指示ADO生成SQL查询以便从在Source中命名的表中返回所有行
adCmdStoredProc 4 Evaluates CommandText as a stored procedure name.
将CommandText作为一个已存的程序名称
adCmdUnknown 8 Indicates that the type of command in the CommandText property is not known.
默认值。指定未知的CommandText属性命令
adCmdFile 256 Evaluates CommandText as the file name of a persistently stored Recordset. Used with Recordset.Open or Requery only.
指示应从在Source中命名的文件中恢复保留(保存的)Recordset。它仅能与Recordset.Open 或 Requery 指令一起使用
adCmdTableDirect 512 Evaluates CommandText as a table name whose columns are all returned. Used with Recordset.Open or Requery only. To use the Seek method, the Recordset must be opened with adCmdTableDirect. This value cannot be combined with the ExecuteOptionEnum value adAsyncExecute.
指示提供者更改从在 Source 中命名的表中返回所有行/
将CommandText作为一个表的名称(该表的列全部是通过内部的SQL查询语句返回的)。它仅适用Recordset.Open 或 Requery 指令;如果需要使用查找方式,那么Recordset必须以adCmdTableDirect打开。这个值不能与ExecuteOptionEnum值 adAsyncExecute一起使用


ExecuteOptionEnum Values

Constant常量 Value值 Description描述
adOptionUnspecified -1 Indicates that the command is unspecified.
指明为指定的指令
adAsyncExecute 16 Indicates that the command should execute asynchronously. This value cannot be combined with the CommandTypeEnum value adCmdTableDirect.
指明指令是否需要异步执行。这个值不能与CommandTypeEnum 之中的adCmdTableDirect一起使用
adAsyncFetch 32 Indicates that the remaining rows after the initial quantity specified in the CacheSize property should be retrieved asynchronously.
指明在CacheSize属性中指定了初始量以后,是否应该异步获取保留行[remaining rows]
adAsyncFetchNonBlocking 64 Indicates that the main thread never blocks while retrieving. If the requested row has not been retrieved, the current row automatically moves to the end of the file. If you open a Recordset from a Stream containing a persistently stored Recordset, adAsyncFetchNonBlocking will not have an effect; the operation will be synchronous and blocking. adAsynchFetchNonBlocking has no effect when the adCmdTableDirect option is used to open the Recordset.
指示主要线程在提取期间从未堵塞。如果所请求的行尚未提取,那么当前行将自动移到文件末尾。如果打开的记录流中的记录固定地包含一个记录,那么adAsyncFetchNonBlocking将不会产生作用;才作程序将同时运行以及阻塞该常量。当adCmdTableDirect选项用于打开记录时,adAsynchFetchNonBlocking将不会产生任何作用
adExecuteNoRecords 128 Indicates that the command text is a command or stored procedure that does not return rows (for example, a command that only inserts data). If any rows are retrieved, they are discarded and not returned. adExecuteNoRecords can only be passed as an optional parameter to the Command or Connection Execute method.
它仅指明了指令文本仅是一条不返回任何行的指令或现存程序(如:一条只执行数据插入的指令)。如果没有任何行被提取,那么他们将放弃执行并不返回任何值。
adExecuteNoRecords仅可以作为一个可选参数传递到指令中或连接执行方法[Connection Execute method]中
adExecuteStream 256 Indicates that the results of a command execution should be returned as a stream. adExecuteStream can only be passed as an optional parameter to the Command Execute method.
指明需要以结果流的形式返回命令执行的结果。adExecuteStream仅可以作为一个可选参数传递到指令中或连接执行方法[Connection Execute method]中
adExecuteRecord 512 Indicates that the CommandText is a command or stored procedure that returns a single row which should be returned as a Record object.
指明CommandText仅是返回一个单独行(该单独行作为一条记录对象返回)的一条指令或现存程序


EventStatusEnum Values

Constant常量 Value值 Description描述
adStatusOK 1 The operation that fired the event was successful
激发事件操作成功
adStatusErrorsOccurred 2 The operation that fired the event failed
激发事件操作失败
adStatusCantDeny 3 Cannot cancel the pending operation
不可以取消正处于处理执行中的操作
adStatusCancel 4 Cancels the operation that fired the event
取消激发事件的操作
adStatusUnwantedEvent 5 Prevents subsequent notifications before the event method has finished executing
在时间的运行方法终止运行之前禁止后续的报告

评论 (0) All

登陆 | 还没注册?