日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

ADO Execute 方法

發(fā)布時(shí)間:2025/3/20 32 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ADO Execute 方法 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

The Execute method executes a specified query, SQL statement, stored procedure, or provider-specific text.
Execute的作用是:執(zhí)行一個(gè)查詢語(yǔ)句、陳述語(yǔ)句、程序或技術(shù)提供對(duì)象[provider]的詳細(xì)文本。

The results are stored in a new Recordset object if it is a row-returning query. A closed Recordset object will be returned if it is not a row-returning query.?
如果返回行[row-returning]查詢語(yǔ)句,那么結(jié)果將被存儲(chǔ)在一個(gè)新的記錄對(duì)象中;如果它不是一個(gè)返回行[row-returning]查詢語(yǔ)句,那么它將返回一個(gè)關(guān)閉的記錄對(duì)象。

Note: The returned Recordset is always a read-only, forward-only Recordset!
注意:返回的Recordset是一個(gè)只讀的、只向前兼容的Recordset。

Tip: To create a Recordset with more functionality, first create a Recordset object. Set the desired properties, and then use the Recordset object's Open method to execute the query.
提示:在第一次創(chuàng)建Recordset對(duì)象時(shí),需要將它創(chuàng)建為一個(gè)更具功能性的Recordset對(duì)象。設(shè)置一個(gè)我們所希望的屬性,使用Recordset對(duì)象的Open方法去執(zhí)行查詢語(yǔ)句。

Syntax for row-returning
row-returning[返回行]語(yǔ)法

Set objrs=objconn.Execute(commandtext,ra,options)

Syntax for non-row-returning
non-row-returning[非返回行]語(yǔ)法

objconn.Execute commandtext,ra,options

Parameter參數(shù)Description描述
commandtext Required. The SQL statement, stored procedure, or provider-specific text to execute
必要參數(shù)。指定需要執(zhí)行的SQL語(yǔ)句,現(xiàn)存的程序或技術(shù)提供對(duì)象[provider]的詳細(xì)文本
ra Optional. The number of records affected by the query
可選參數(shù)。返回查詢語(yǔ)句執(zhí)行的記錄數(shù)
options Optional. Sets how the provider should evaluate the commandtext parameter. Can be one or more CommandTypeEnum or ExecuteOptionEnum values. Default is adCmdUnspecified
可選參數(shù)。設(shè)置技術(shù)提供對(duì)象[provider]應(yīng)該如何評(píng)估CommandText屬性的功能。它可以是一個(gè)或多個(gè)CommandTypeEnum 或 ExecuteOptionEnum的值。默認(rèn)值是adCmdUnspecified

Example
案例

<% sql="SELECT companyname FROM Customers" Set rs=conn.Execute(sql) %>


?

CommandTypeEnum Values

?

?

Constant常量Value值Description描述
adCmdUnspecified-1Does not specify the command type argument.
不指定指令類型自變量
adCmdText1Evaluates CommandText as a textual definition of a command or stored procedure call.
指示提供者應(yīng)該將Source作為命令的文本定義來(lái)計(jì)算。
adCmdTable2Evaluates CommandText as a table name whose columns are all returned by an internally generated SQL query.
指示ADO生成SQL查詢以便從在Source中命名的表中返回所有行
adCmdStoredProc4Evaluates CommandText as a stored procedure name.
將CommandText作為一個(gè)已存的程序名稱
adCmdUnknown8Indicates that the type of command in the CommandText property is not known.
默認(rèn)值。指定未知的CommandText屬性命令
adCmdFile256Evaluates CommandText as the file name of a persistently stored Recordset. Used with Recordset.Open or Requery only.
指示應(yīng)從在Source中命名的文件中恢復(fù)保留(保存的)Recordset。它僅能與Recordset.Open 或 Requery 指令一起使用
adCmdTableDirect512Evaluates 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作為一個(gè)表的名稱(該表的列全部是通過(guò)內(nèi)部的SQL查詢語(yǔ)句返回的)。它僅適用Recordset.Open 或 Requery 指令;如果需要使用查找方式,那么Recordset必須以adCmdTableDirect打開(kāi)。這個(gè)值不能與ExecuteOptionEnum值 adAsyncExecute一起使用

?

?


?

ExecuteOptionEnum Values

?

?

Constant常量Value值Description描述
adOptionUnspecified-1Indicates that the command is unspecified.
指明為指定的指令
adAsyncExecute?Indicates that the command should execute asynchronously. This value cannot be combined with the CommandTypeEnum value adCmdTableDirect.
指明指令是否需要異步執(zhí)行。這個(gè)值不能與CommandTypeEnum 之中的adCmdTableDirect一起使用
adAsyncFetch?Indicates that the remaining rows after the initial quantity specified in the CacheSize property should be retrieved asynchronously.
指明在CacheSize屬性中指定了初始量以后,是否應(yīng)該異步獲取保留行[remaining rows]
adAsyncFetchNonBlocking?

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.
指示主要線程在提取期間從未堵塞。如果所請(qǐng)求的行尚未提取,那么當(dāng)前行將自動(dòng)移到文件末尾。如果打開(kāi)的記錄流中的記錄固定地包含一個(gè)記錄,那么adAsyncFetchNonBlocking將不會(huì)產(chǎn)生作用;才作程序?qū)⑼瑫r(shí)運(yùn)行以及阻塞該常量。當(dāng)adCmdTableDirect選項(xiàng)用于打開(kāi)記錄時(shí),adAsynchFetchNonBlocking將不會(huì)產(chǎn)生任何作用

adExecuteNoRecords?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.
它僅指明了指令文本僅是一條不返回任何行的指令或現(xiàn)存程序(如:一條只執(zhí)行數(shù)據(jù)插入的指令)。如果沒(méi)有任何行被提取,那么他們將放棄執(zhí)行并不返回任何值。
adExecuteNoRecords僅可以作為一個(gè)可選參數(shù)傳遞到指令中或連接執(zhí)行方法[Connection Execute method]中
adExecuteStream?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.
指明需要以結(jié)果流的形式返回命令執(zhí)行的結(jié)果。adExecuteStream僅可以作為一個(gè)可選參數(shù)傳遞到指令中或連接執(zhí)行方法[Connection Execute method]中
adExecuteRecord?Indicates that the CommandText is a command or stored procedure that returns a single row which should be returned as a Record object.
指明CommandText僅是返回一個(gè)單獨(dú)行(該單獨(dú)行作為一條記錄對(duì)象返回)的一條指令或現(xiàn)存程序

總結(jié)

以上是生活随笔為你收集整理的ADO Execute 方法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。