CommonNetFuncs.Sql.SqlServer
3.5.0
dotnet add package CommonNetFuncs.Sql.SqlServer --version 3.5.0
NuGet\Install-Package CommonNetFuncs.Sql.SqlServer -Version 3.5.0
<PackageReference Include="CommonNetFuncs.Sql.SqlServer" Version="3.5.0" />
<PackageVersion Include="CommonNetFuncs.Sql.SqlServer" Version="3.5.0" />
<PackageReference Include="CommonNetFuncs.Sql.SqlServer" />
paket add CommonNetFuncs.Sql.SqlServer --version 3.5.0
#r "nuget: CommonNetFuncs.Sql.SqlServer, 3.5.0"
#addin nuget:?package=CommonNetFuncs.Sql.SqlServer&version=3.5.0
#tool nuget:?package=CommonNetFuncs.Sql.SqlServer&version=3.5.0
CommonNetFuncs.Sql.SqlServer
This project contains helper methods for executing SQL queries and commands against an SQL Server database.
Contents
DirectQuery
Helper methods for executing SQL queries and commands directly against an SQL Server database.
DirectQuery Usage Examples
<details> <summary><h3>Usage Examples</h3></summary>
GetDataTable
Executes a SELECT query asynchronously and returns the results as a DataTable.
string sql = "SELECT * FROM TestTable";
using DataTable queryResultsTable = await DirectQuery.GetDataTable(sql, connectionString); // queryResultsTable will contain the results of the query
GetDataTableSynchronous
Executes a SELECT query synchronously and returns the results as a DataTable.
string sql = "SELECT * FROM TestTable";
using DataTable queryResultsTable = DirectQuery.GetDataTable(sql, connectionString); // queryResultsTable will contain the results of the query
RunUpdateQuery
Executes an UPDATE, INSERT, or DELETE query asynchronously and returns an UpdateResult containing the number of affected rows and a boolean indicating success.
string sql = "UPDATE TestTable SET Name = 'Updated' WHERE Name LIKE 'Test%'";
UpdateResult updateResult = await DirectQuery.RunUpdateQuery(sql, connectionString); // { RecordsChanged = 1, Success = true }
RunUpdateQuerySynchronous
Executes an UPDATE, INSERT, or DELETE query synchronously and returns an UpdateResult containing the number of affected rows and a boolean indicating success.
string sql = "UPDATE TestTable SET Name = 'Updated' WHERE Name LIKE 'Test%'";
UpdateResult updateResult = DirectQuery.RunUpdateQuerySynchronous(sql, connectionString); // { RecordsChanged = 1, Success = true }
GetDataStreamSynchronous
Gets a data from a query synchronously and returns an IEnumerable of the query result type.
string sql = "SELECT * FROM TestTable";
IEnumerable<TestEntity> queryResults = DirectQuery.GetDataStreamSynchronous(sql, connectionString); // queryResults will contain the results of the query as TestEntity objects
GetDataStreamAsync
Gets a data from a query asynchronously and returns an IAsyncEnumerable of the query result type.
List<TestModel> results = new();
string sql = "SELECT * FROM TestTable";
await foreach (TestModel item in DirectQuery.GetDataStreamAsync<TestModel>(sql, connectionString))
{
results.Add(item); // Results will contain all items returned by the query
}
GetDataDirectAsync
Gets a data from a query asynchronously and returns an IEnumerable of the query result type.
string sql = "SELECT * FROM TestTable";
IEnumerable<TestEntity> queryResults = await DirectQuery.GetDataDirectAsync(sql, connectionString); // queryResults will contain the results of the query as TestEntity objects
</details>
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- CommonNetFuncs.Sql.Common (>= 3.5.0)
- Microsoft.Data.SqlClient (>= 6.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated |
---|---|---|
3.5.0 | 0 | 7/7/2025 |
3.4.23 | 125 | 6/26/2025 |
3.4.21 | 126 | 6/26/2025 |
3.4.20 | 129 | 6/25/2025 |
3.4.18 | 131 | 6/23/2025 |
3.4.9 | 278 | 6/11/2025 |
3.4.8 | 272 | 6/11/2025 |
3.4.2 | 134 | 6/2/2025 |
3.4.1 | 86 | 5/30/2025 |
3.4.0 | 134 | 5/30/2025 |
3.3.11 | 141 | 5/19/2025 |
3.3.10 | 225 | 5/13/2025 |
3.3.0 | 162 | 4/29/2025 |
3.2.28 | 161 | 4/10/2025 |
3.2.22 | 165 | 3/12/2025 |
3.2.13 | 113 | 2/13/2025 |
3.2.9 | 106 | 2/4/2025 |
3.2.6 | 99 | 1/28/2025 |
3.2.5 | 86 | 1/27/2025 |
3.2.3 | 100 | 1/17/2025 |
3.2.0 | 109 | 12/19/2024 |
3.1.0 | 121 | 12/6/2024 |
3.0.0 | 121 | 12/3/2024 |
2.1.3 | 116 | 12/3/2024 |
2.1.0 | 105 | 12/2/2024 |
2.0.5 | 106 | 11/26/2024 |
2.0.2 | 110 | 11/18/2024 |
2.0.1 | 102 | 11/15/2024 |
2.0.0 | 108 | 11/14/2024 |
1.0.47 | 102 | 11/14/2024 |
1.0.42 | 115 | 11/12/2024 |
1.0.40 | 110 | 11/12/2024 |
1.0.37 | 106 | 11/4/2024 |
1.0.31 | 112 | 10/31/2024 |
1.0.28 | 106 | 10/25/2024 |
1.0.26 | 155 | 10/18/2024 |
1.0.25 | 94 | 10/17/2024 |
1.0.24 | 92 | 10/17/2024 |
1.0.20 | 111 | 10/11/2024 |
1.0.19 | 114 | 10/11/2024 |
1.0.18 | 105 | 10/4/2024 |
1.0.17 | 120 | 9/27/2024 |
1.0.16 | 110 | 9/27/2024 |
1.0.14 | 109 | 9/23/2024 |
1.0.13 | 120 | 9/18/2024 |
1.0.11 | 113 | 9/18/2024 |
1.0.10 | 165 | 9/11/2024 |
1.0.9 | 132 | 9/11/2024 |
1.0.8 | 132 | 9/11/2024 |
1.0.7 | 131 | 9/11/2024 |
1.0.1 | 123 | 9/4/2024 |
1.0.0 | 117 | 9/2/2024 |