ServerConnection.ExecuteNonQuery 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| ExecuteNonQuery(StringCollection) | |
| ExecuteNonQuery(String) | |
| ExecuteNonQuery(StringCollection, ExecutionTypes) |
執行 StringCollection 中的 T-SQL 語句。 指令終止符(「GO」)會被 ExecuteNonQuery 識別。 使用 GO 語句分離的批次將被單獨傳送並執行。 如果 CaptureMode 設為 true,則該語句會被記錄而非執行。 會回傳一個整數值陣列,包含 StringCollection 中每個語句受影響的列數。 若執行多個批次,則會回傳所有批次中受影響列的總數。 如果與伺服器的連線未開啟,則會呼叫 Connect() 方法。 例外:ConnectionFailureException ExecutionFailureExeception |
| ExecuteNonQuery(String, ExecutionTypes) |
執行一個 T-SQL 陳述式。 指令終止符(「GO」)會被 ExecuteNonQuery 識別。 批次將分別發送並執行。 如果 CaptureMode 設為 true,則該語句會被記錄而非執行。 會回傳一個包含受影響列數的整數值。 若執行多個批次,則會回傳所有批次中受影響列的總數。 如果與伺服器的連線未開啟,則會呼叫 Connect() 方法。 例外:ConnectionFailureException ExecutionFailureExeception |
| ExecuteNonQuery(StringCollection, ExecutionTypes, Boolean) |
執行 StringCollection 中的 T-SQL 語句。 指令終止符(「GO」)會被 ExecuteNonQuery 識別。 使用 GO 語句分離的批次將被單獨傳送並執行。 如果 CaptureMode 設為 true,則該語句會被記錄而非執行。 會回傳一個整數值陣列,包含 StringCollection 中每個語句受影響的列數。 若執行多個批次,則會回傳所有批次中受影響列的總數。 如果與伺服器的連線未開啟,則會呼叫 Connect() 方法。 例外:ConnectionFailureException ExecutionFailureExeception |
| ExecuteNonQuery(String, ExecutionTypes, Boolean) |
執行一個 T-SQL 陳述式。 指令終止符(「GO」)會被 ExecuteNonQuery 識別。 批次將分別發送並執行。 如果 CaptureMode 設為 true,則該語句會被記錄而非執行。 會回傳一個包含受影響列數的整數值。 若執行多個批次,則會回傳所有批次中受影響列的總數。 如果與伺服器的連線未開啟,則會呼叫 Connect() 方法。 例外:ConnectionFailureException ExecutionFailureExeception |
ExecuteNonQuery(StringCollection)
public int[] ExecuteNonQuery(System.Collections.Specialized.StringCollection sqlCommands);
member this.ExecuteNonQuery : System.Collections.Specialized.StringCollection -> int[]
Public Function ExecuteNonQuery (sqlCommands As StringCollection) As Integer()
參數
- sqlCommands
- StringCollection
傳回
適用於
ExecuteNonQuery(StringCollection, ExecutionTypes)
執行 StringCollection 中的 T-SQL 語句。 指令終止符(「GO」)會被 ExecuteNonQuery 識別。 使用 GO 語句分離的批次將被單獨傳送並執行。 如果 CaptureMode 設為 true,則該語句會被記錄而非執行。 會回傳一個整數值陣列,包含 StringCollection 中每個語句受影響的列數。 若執行多個批次,則會回傳所有批次中受影響列的總數。 如果與伺服器的連線未開啟,則會呼叫 Connect() 方法。 例外:ConnectionFailureException ExecutionFailureExeception
public int[] ExecuteNonQuery(System.Collections.Specialized.StringCollection sqlCommands, Microsoft.SqlServer.Management.Common.ExecutionTypes executionType);
member this.ExecuteNonQuery : System.Collections.Specialized.StringCollection * Microsoft.SqlServer.Management.Common.ExecutionTypes -> int[]
Public Function ExecuteNonQuery (sqlCommands As StringCollection, executionType As ExecutionTypes) As Integer()
參數
- sqlCommands
- StringCollection
- executionType
- ExecutionTypes
傳回
適用於
ExecuteNonQuery(String, ExecutionTypes)
執行一個 T-SQL 陳述式。 指令終止符(「GO」)會被 ExecuteNonQuery 識別。 批次將分別發送並執行。 如果 CaptureMode 設為 true,則該語句會被記錄而非執行。 會回傳一個包含受影響列數的整數值。 若執行多個批次,則會回傳所有批次中受影響列的總數。 如果與伺服器的連線未開啟,則會呼叫 Connect() 方法。 例外:ConnectionFailureException ExecutionFailureExeception
public int ExecuteNonQuery(string sqlCommand, Microsoft.SqlServer.Management.Common.ExecutionTypes executionType);
member this.ExecuteNonQuery : string * Microsoft.SqlServer.Management.Common.ExecutionTypes -> int
Public Function ExecuteNonQuery (sqlCommand As String, executionType As ExecutionTypes) As Integer
參數
- sqlCommand
- String
- executionType
- ExecutionTypes
傳回
適用於
ExecuteNonQuery(StringCollection, ExecutionTypes, Boolean)
執行 StringCollection 中的 T-SQL 語句。 指令終止符(「GO」)會被 ExecuteNonQuery 識別。 使用 GO 語句分離的批次將被單獨傳送並執行。 如果 CaptureMode 設為 true,則該語句會被記錄而非執行。 會回傳一個整數值陣列,包含 StringCollection 中每個語句受影響的列數。 若執行多個批次,則會回傳所有批次中受影響列的總數。 如果與伺服器的連線未開啟,則會呼叫 Connect() 方法。 例外:ConnectionFailureException ExecutionFailureExeception
public int[] ExecuteNonQuery(System.Collections.Specialized.StringCollection sqlCommands, Microsoft.SqlServer.Management.Common.ExecutionTypes executionType, bool retry);
member this.ExecuteNonQuery : System.Collections.Specialized.StringCollection * Microsoft.SqlServer.Management.Common.ExecutionTypes * bool -> int[]
Public Function ExecuteNonQuery (sqlCommands As StringCollection, executionType As ExecutionTypes, retry As Boolean) As Integer()
參數
- sqlCommands
- StringCollection
- executionType
- ExecutionTypes
- retry
- Boolean
如果執行時拋出例外,是否應該重試
傳回
適用於
ExecuteNonQuery(String, ExecutionTypes, Boolean)
執行一個 T-SQL 陳述式。 指令終止符(「GO」)會被 ExecuteNonQuery 識別。 批次將分別發送並執行。 如果 CaptureMode 設為 true,則該語句會被記錄而非執行。 會回傳一個包含受影響列數的整數值。 若執行多個批次,則會回傳所有批次中受影響列的總數。 如果與伺服器的連線未開啟,則會呼叫 Connect() 方法。 例外:ConnectionFailureException ExecutionFailureExeception
public int ExecuteNonQuery(string sqlCommand, Microsoft.SqlServer.Management.Common.ExecutionTypes executionType, bool retry);
member this.ExecuteNonQuery : string * Microsoft.SqlServer.Management.Common.ExecutionTypes * bool -> int
Public Function ExecuteNonQuery (sqlCommand As String, executionType As ExecutionTypes, retry As Boolean) As Integer
參數
- sqlCommand
- String
- executionType
- ExecutionTypes
- retry
- Boolean
如果執行時拋出例外,是否應該重試