日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ADO Execute 方法

發布時間:2025/3/20 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ADO Execute 方法 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

The Execute method executes a specified query, SQL statement, stored procedure, or provider-specific text.
Execute的作用是:執行一個查詢語句、陳述語句、程序或技術提供對象[provider]的詳細文本。

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]查詢語句,那么結果將被存儲在一個新的記錄對象中;如果它不是一個返回行[row-returning]查詢語句,那么它將返回一個關閉的記錄對象。

Note: The returned Recordset is always a read-only, forward-only Recordset!
注意:返回的Recordset是一個只讀的、只向前兼容的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.
提示:在第一次創建Recordset對象時,需要將它創建為一個更具功能性的Recordset對象。設置一個我們所希望的屬性,使用Recordset對象的Open方法去執行查詢語句。

Syntax for row-returning
row-returning[返回行]語法

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

Syntax for non-row-returning
non-row-returning[非返回行]語法

objconn.Execute commandtext,ra,options

Parameter參數Description描述
commandtext Required. The SQL statement, stored procedure, or provider-specific text to execute
必要參數。指定需要執行的SQL語句,現存的程序或技術提供對象[provider]的詳細文本
ra Optional. The number of records affected by the query
可選參數。返回查詢語句執行的記錄數
options Optional. Sets how the provider should evaluate the commandtext parameter. Can be one or more CommandTypeEnum or ExecuteOptionEnum values. Default is adCmdUnspecified
可選參數。設置技術提供對象[provider]應該如何評估CommandText屬性的功能。它可以是一個或多個CommandTypeEnum 或 ExecuteOptionEnum的值。默認值是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.
指示提供者應該將Source作為命令的文本定義來計算。
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作為一個已存的程序名稱
adCmdUnknown8Indicates that the type of command in the CommandText property is not known.
默認值。指定未知的CommandText屬性命令
adCmdFile256Evaluates CommandText as the file name of a persistently stored Recordset. Used with Recordset.Open or Requery only.
指示應從在Source中命名的文件中恢復保留(保存的)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作為一個表的名稱(該表的列全部是通過內部的SQL查詢語句返回的)。它僅適用Recordset.Open 或 Requery 指令;如果需要使用查找方式,那么Recordset必須以adCmdTableDirect打開。這個值不能與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.
指明指令是否需要異步執行。這個值不能與CommandTypeEnum 之中的adCmdTableDirect一起使用
adAsyncFetch?Indicates that the remaining rows after the initial quantity specified in the CacheSize property should be retrieved asynchronously.
指明在CacheSize屬性中指定了初始量以后,是否應該異步獲取保留行[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.
指示主要線程在提取期間從未堵塞。如果所請求的行尚未提取,那么當前行將自動移到文件末尾。如果打開的記錄流中的記錄固定地包含一個記錄,那么adAsyncFetchNonBlocking將不會產生作用;才作程序將同時運行以及阻塞該常量。當adCmdTableDirect選項用于打開記錄時,adAsynchFetchNonBlocking將不會產生任何作用

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.
它僅指明了指令文本僅是一條不返回任何行的指令或現存程序(如:一條只執行數據插入的指令)。如果沒有任何行被提取,那么他們將放棄執行并不返回任何值。
adExecuteNoRecords僅可以作為一個可選參數傳遞到指令中或連接執行方法[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.
指明需要以結果流的形式返回命令執行的結果。adExecuteStream僅可以作為一個可選參數傳遞到指令中或連接執行方法[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僅是返回一個單獨行(該單獨行作為一條記錄對象返回)的一條指令或現存程序

總結

以上是生活随笔為你收集整理的ADO Execute 方法的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。