You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit c4c2f9e
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: doc/snippets/Microsoft.Data.SqlClient/SqlBatch.xml
+25-14Lines changed: 25 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -235,11 +235,16 @@
235
235
<ExecuteReadername="BehaviorParameter">
236
236
<paramname="behavior">
237
237
An instance of <seecref="T:System.Data.CommandBehavior" />, specifying options for batch execution and data retrieval.
238
-
Only <seecref="F:System.Data.CommandBehavior.SequentialAccess"/> and <seecref="F:System.Data.CommandBehavior.CloseConnection"/> are supported at the batch level.
238
+
Supported values at the batch level are <seecref="F:System.Data.CommandBehavior.Default"/>,
or a bitwise combination of <seecref="F:System.Data.CommandBehavior.SequentialAccess"/> and <seecref="F:System.Data.CommandBehavior.CloseConnection"/>.
239
241
</param>
240
242
<summary>
241
243
Sends the <seecref="P:Microsoft.Data.SqlClient.SqlBatch.Commands" /> to the <seecref="P:Microsoft.Data.SqlClient.SqlCommand.Connection" /> and builds a <seecref="T:Microsoft.Data.SqlClient.SqlDataReader" />.
The <paramrefname="behavior" /> value is invalid or is not supported at the batch level.
247
+
</exception>
243
248
<example>
244
249
<para>
245
250
The following example creates a <seecref="T:Microsoft.Data.SqlClient.SqlConnection" /> and a <seecref="T:Microsoft.Data.SqlClient.SqlBatch" />, then adds multiple <seecref="T:Microsoft.Data.SqlClient.SqlBatchCommand" /> objects to the batch. It then executes the batch, creating a <seecref="T:Microsoft.Data.SqlClient.SqlDataReader" />. The example reads through the results of the batch commands, writing them to the console. Finally, the example closes the <seecref="T:Microsoft.Data.SqlClient.SqlDataReader" /> and then the <seecref="T:Microsoft.Data.SqlClient.SqlConnection" /> as the <c>using</c> blocks fall out of scope.
@@ -293,35 +298,34 @@
293
298
<paramname="cancellationToken">A token to cancel the asynchronous operation.</param>
294
299
<summary>
295
300
An asynchronous version of <seecref="M:Microsoft.Data.SqlClient.SqlBatch.ExecuteReader" />, which sends the <seecref="P:Microsoft.Data.SqlClient.SqlBatch.Commands" /> to the <seecref="P:Microsoft.Data.SqlClient.SqlBatch.Connection" /> and builds a <seecref="T:Microsoft.Data.SqlClient.SqlDataReader" />.
296
-
Exceptions will be reported via the returned Task object.
301
+
Operational exceptions are reported via the returned task; usage exceptions are thrown synchronously.
297
302
</summary>
298
303
<returns>A task representing the asynchronous operation.</returns>
The cancellation token was canceled. This exception is stored into the returned task.
307
309
</exception>
308
310
</ExecuteReaderAsync>
309
311
<ExecuteReaderAsyncname="BehaviorParameter">
310
312
<paramname="behavior">
311
313
An instance of <seecref="T:System.Data.CommandBehavior" />, specifying options for batch execution and data retrieval.
312
-
Only <seecref="F:System.Data.CommandBehavior.SequentialAccess"/> and <seecref="F:System.Data.CommandBehavior.CloseConnection"/> are supported at the batch level.
314
+
Supported values at the batch level are <seecref="F:System.Data.CommandBehavior.Default"/>,
or a bitwise combination of <seecref="F:System.Data.CommandBehavior.SequentialAccess"/> and <seecref="F:System.Data.CommandBehavior.CloseConnection"/>.
313
317
</param>
314
318
<paramname="cancellationToken">A token to cancel the asynchronous operation.</param>
315
319
<summary>
316
320
An asynchronous version of <seecref="M:Microsoft.Data.SqlClient.SqlBatch.ExecuteReader" />, which sends the <seecref="P:Microsoft.Data.SqlClient.SqlBatch.Commands" /> to the <seecref="P:Microsoft.Data.SqlClient.SqlBatch.Connection" /> and builds a <seecref="T:Microsoft.Data.SqlClient.SqlDataReader" />.
317
-
Exceptions will be reported via the returned Task object.
321
+
Operational exceptions are reported via the returned task; usage exceptions are thrown synchronously.
318
322
</summary>
319
323
<returns>A task representing the asynchronous operation.</returns>
The cancellation token was canceled. This exception is stored into the returned task.
@@ -381,7 +385,9 @@
381
385
<ExecuteDbDataReader>
382
386
<paramname="behavior">
383
387
An instance of <seecref="T:System.Data.CommandBehavior" />, specifying options for batch execution and data retrieval.
384
-
Only <seecref="F:System.Data.CommandBehavior.SequentialAccess"/> and <seecref="F:System.Data.CommandBehavior.CloseConnection"/> are supported at the batch level.
388
+
Supported values at the batch level are <seecref="F:System.Data.CommandBehavior.Default"/>,
or a bitwise combination of <seecref="F:System.Data.CommandBehavior.SequentialAccess"/> and <seecref="F:System.Data.CommandBehavior.CloseConnection"/>.
385
391
</param>
386
392
<summary>
387
393
Executes the batch against its connection, returning a <seecref="T:Microsoft.Data.SqlClient.SqlDataReader" /> which can be used to access the results.
@@ -400,14 +406,16 @@ When the batch returns multiple result sets from different commands, <xref:Micro
The <paramrefname="behavior" /> value is invalid or is not supported at the batch level.
405
411
</exception>
406
412
</ExecuteDbDataReader>
407
413
<ExecuteDbDataReaderAsync>
408
414
<paramname="behavior">
409
415
An instance of <seecref="T:System.Data.CommandBehavior" />, specifying options for batch execution and data retrieval.
410
-
Only <seecref="F:System.Data.CommandBehavior.SequentialAccess"/> and <seecref="F:System.Data.CommandBehavior.CloseConnection"/> are supported at the batch level.
416
+
Supported values at the batch level are <seecref="F:System.Data.CommandBehavior.Default"/>,
or a bitwise combination of <seecref="F:System.Data.CommandBehavior.SequentialAccess"/> and <seecref="F:System.Data.CommandBehavior.CloseConnection"/>.
411
419
</param>
412
420
<paramname="cancellationToken">A token to cancel the asynchronous operation.</param>
413
421
<summary>
@@ -419,13 +427,16 @@ When the batch returns multiple result sets from different commands, <xref:Micro
419
427
<.
421
429
422
-
This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as <xref:System.ArgumentException>, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by <xref:System.Data.Common.DbBatch.ExecuteDbDataReader(System.Data.CommandBehavior)>.
430
+
This method stores exceptions in the task it returns, including exceptions for invalid or unsupported behavior values. These exceptions are thrown when the task is awaited. For possible exceptions, see <xref:Microsoft.Data.SqlClient.SqlBatch.ExecuteReader(System.Data.CommandBehavior)>.
423
431
424
432
> [!NOTE]
425
433
> This method benefits from <xref:Microsoft.Data.SqlClient.SqlCommand.ExecuteReaderAsync(System.Threading.CancellationToken)>, and all the expected exceptions of that method also apply here.
0 commit comments