ExecuteNonQueryAsync Method

Overview

The ExecuteNonQueryAsync method executes a command that does not return result sets. The public overloads support table-valued parameters, optionally combined with scalar parameters.

Declarations

/// <summary>
/// Executes a non-query command using table-valued parameter descriptions.
/// </summary>
public async Task<int> ExecuteNonQueryAsync(string baseQuery, bool isStoredProcedure, SqlTableValuedParameterInfo[]? tableValuedParameters, string? connectionString = null)

/// <summary>
/// Executes a non-query command using table-valued parameter descriptions and scalar parameters.
/// </summary>
public async Task<int> ExecuteNonQueryAsync(string baseQuery, bool isStoredProcedure, SqlTableValuedParameterInfo[]? tableValuedParameters, Dictionary<string, object?>? parameters, string? connectionString = null)

Namespace and Assembly

Namespace: PocoDataSet.SqlServerDataAdapter
Assembly: PocoDataSet.SqlServerDataAdapter.dll

Usage Example

IDataSet dataSet = DataSetFactory.CreateDataSet();
IDataTable table = dataSet.AddNewTable("HostedApplicationLayer");
table.AddColumn("DomainName", DataTypeNames.STRING);
table.AddColumn("UseCaseName", DataTypeNames.STRING);
table.AddColumn("ApplicationLayerName", DataTypeNames.STRING);
table.AddColumn("Url", DataTypeNames.STRING);

IDataRow row = table.AddNewRow();
row["DomainName"] = "HR";
row["UseCaseName"] = "Accounting";
row["ApplicationLayerName"] = "DAL";
row["Url"] = "http://localhost:5075";

SqlTableValuedParameterInfo[] tableValuedParameters = new SqlTableValuedParameterInfo[1];
tableValuedParameters[0] = new SqlTableValuedParameterInfo("@HostedApplicationLayer", "dbo.HostedApplicationLayer", table);

Dictionary<string, object?> parameters = new Dictionary<string, object?>();
parameters.Add("@UserGuid", Guid.Parse("33333333-3333-3333-3333-333333333333"));
parameters.Add("@UserName", "IntegrationTest_Scalar");

SqlDataAdapter adapter = new SqlDataAdapter(connectionString);

int affectedRows = await adapter.ExecuteNonQueryAsync("dbo.HostedApplicationLayer_Synchronize", true, tableValuedParameters, parameters, null).ConfigureAwait(false);

 

Table of Content POCO DataSet API References SqlDataAdapter Members

 


Business Process Programming in .Net
© 2004–2026 Laskarzhevsky Software Inc.
Unless otherwise noted, the content of this website is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).
Code examples are provided under the MIT License.
You are free to share and adapt the material provided that appropriate credit is given and any modifications are clearly indicated.
The information provided on this website is for educational purposes only.
The author and publisher make no warranties regarding the completeness or suitability of the information and are not responsible for any damages resulting from its use.