Share via


ServerConnection.ExecuteNonQuery Method

Definition

Overloads

ExecuteNonQuery(StringCollection)
ExecuteNonQuery(String)
ExecuteNonQuery(StringCollection, ExecutionTypes)

Executes the T-SQL statements in the StringCollection. The command termininator ('GO') is recognized by ExecuteNonQuery. Batches separated with the GO statement will be sent and executed individually. The statement is recorded and not executed if CaptureMode has been set to true. An array of int values is returned that contain the numbers of rows affected for each statement in the StringCollection. If multiple batches are executed, the total numbers of affected rows of all batches is returned. The Connect() method will be called if the connection with the server is not open. Exceptions: ConnectionFailureException ExecutionFailureExeception

ExecuteNonQuery(String, ExecutionTypes)

Executes a T-SQL statement. The command termininator ('GO') is recognized by ExecuteNonQuery. Batches will be sent and executed individually. The statement is recorded and not executed if CaptureMode has been set to true. An int value is returned that contain the numbers of rows affected. If multiple batches are executed, the total numbers of affected rows of all batches is returned. The Connect() method will be called if the connection with the server is not open. Exceptions: ConnectionFailureException ExecutionFailureExeception

ExecuteNonQuery(StringCollection, ExecutionTypes, Boolean)

Executes the T-SQL statements in the StringCollection. The command termininator ('GO') is recognized by ExecuteNonQuery. Batches separated with the GO statement will be sent and executed individually. The statement is recorded and not executed if CaptureMode has been set to true. An array of int values is returned that contain the numbers of rows affected for each statement in the StringCollection. If multiple batches are executed, the total numbers of affected rows of all batches is returned. The Connect() method will be called if the connection with the server is not open. Exceptions: ConnectionFailureException ExecutionFailureExeception

ExecuteNonQuery(String, ExecutionTypes, Boolean)

Executes a T-SQL statement. The command termininator ('GO') is recognized by ExecuteNonQuery. Batches will be sent and executed individually. The statement is recorded and not executed if CaptureMode has been set to true. An int value is returned that contain the numbers of rows affected. If multiple batches are executed, the total numbers of affected rows of all batches is returned. The Connect() method will be called if the connection with the server is not open. Exceptions: 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()

Parameters

sqlCommands
StringCollection

Returns

Int32[]

Applies to

ExecuteNonQuery(String)

public int ExecuteNonQuery (string sqlCommand);
member this.ExecuteNonQuery : string -> int
Public Function ExecuteNonQuery (sqlCommand As String) As Integer

Parameters

sqlCommand
String

Returns

Applies to

ExecuteNonQuery(StringCollection, ExecutionTypes)

Executes the T-SQL statements in the StringCollection. The command termininator ('GO') is recognized by ExecuteNonQuery. Batches separated with the GO statement will be sent and executed individually. The statement is recorded and not executed if CaptureMode has been set to true. An array of int values is returned that contain the numbers of rows affected for each statement in the StringCollection. If multiple batches are executed, the total numbers of affected rows of all batches is returned. The Connect() method will be called if the connection with the server is not open. Exceptions: 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()

Parameters

sqlCommands
StringCollection
executionType
ExecutionTypes

Returns

Int32[]

Applies to

ExecuteNonQuery(String, ExecutionTypes)

Executes a T-SQL statement. The command termininator ('GO') is recognized by ExecuteNonQuery. Batches will be sent and executed individually. The statement is recorded and not executed if CaptureMode has been set to true. An int value is returned that contain the numbers of rows affected. If multiple batches are executed, the total numbers of affected rows of all batches is returned. The Connect() method will be called if the connection with the server is not open. Exceptions: 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

Parameters

sqlCommand
String
executionType
ExecutionTypes

Returns

Applies to

ExecuteNonQuery(StringCollection, ExecutionTypes, Boolean)

Executes the T-SQL statements in the StringCollection. The command termininator ('GO') is recognized by ExecuteNonQuery. Batches separated with the GO statement will be sent and executed individually. The statement is recorded and not executed if CaptureMode has been set to true. An array of int values is returned that contain the numbers of rows affected for each statement in the StringCollection. If multiple batches are executed, the total numbers of affected rows of all batches is returned. The Connect() method will be called if the connection with the server is not open. Exceptions: 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()

Parameters

sqlCommands
StringCollection
executionType
ExecutionTypes
retry
Boolean

Whether we should retry if an exception is thrown during execution

Returns

Int32[]

Applies to

ExecuteNonQuery(String, ExecutionTypes, Boolean)

Executes a T-SQL statement. The command termininator ('GO') is recognized by ExecuteNonQuery. Batches will be sent and executed individually. The statement is recorded and not executed if CaptureMode has been set to true. An int value is returned that contain the numbers of rows affected. If multiple batches are executed, the total numbers of affected rows of all batches is returned. The Connect() method will be called if the connection with the server is not open. Exceptions: 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

Parameters

sqlCommand
String
executionType
ExecutionTypes
retry
Boolean

Whether we should retry if an exception is thrown during execution

Returns

Applies to