SQLHelper.DB 5.0.30

There is a newer version of this package available.
See the version list below for details.
dotnet add package SQLHelper.DB --version 5.0.30
                    
NuGet\Install-Package SQLHelper.DB -Version 5.0.30
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SQLHelper.DB" Version="5.0.30" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SQLHelper.DB" Version="5.0.30" />
                    
Directory.Packages.props
<PackageReference Include="SQLHelper.DB" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SQLHelper.DB --version 5.0.30
                    
#r "nuget: SQLHelper.DB, 5.0.30"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=SQLHelper.DB&version=5.0.30
                    
Install SQLHelper.DB as a Cake Addin
#tool nuget:?package=SQLHelper.DB&version=5.0.30
                    
Install SQLHelper.DB as a Cake Tool

SQLHelper

Build status

SQLHelper is a simple class to help with running queries against a database.

Basic Usage

In order to use the system, you do need register it with your ServiceCollection:

serviceCollection.AddCanisterModules();
				

This is required prior to using the SQLHelper class for the first time. Once Canister is set up, you can use the SQLHelper class:

var Configuration = new ConfigurationBuilder()
            .AddInMemoryCollection()
            .Build();
var Instance = new SQLHelper(Configuration, SqlClientFactory.Instance, "ConnectionString");

Or simply ask for an instance using dependency injection:

public MyClass(SQLHelper helper) { ... }

The SQLHelper class takes in a IConfiguration class, a DbProviderFactory class, and the connection string. The connection string can just be the name of a connection string in your configuration object. Once an instance is set up, you can create a batch, add queries, and then execute them.

var Results = Instance.CreateBatch()
            		   .AddQuery(CommandType.Text,"SELECT * FROM [TestDatabase].[dbo].[TestTable]")
            		   .AddQuery(CommandType.Text,"SELECT * FROM [TestDatabase].[dbo].[TestTable2]")
            		   .AddQuery(CommandType.Text,"SELECT * FROM [TestDatabase].[dbo].[TestTable3]")
            		   .Execute();
					   

The Results object then holds the results for all 3 queries and is returned as IList<IList<dynamic>>. So in order to get the results from the queries:

var FirstQueryResults = Results[0];
var SecondQueryResults = Results[1];
var ThirdQueryResults = Results[2];

It is also possible to convert the results from the dynamic type to a class type that you specify:

var TestTableClasses = FirstQueryResults.Select(x => (TestTableClass)x).ToList();

The type will be converted automatically for you with no special type conversion required. SQLHelper also has an ExecuteScalar function:

var Result = Instance.ExecuteScalar<int>();

This will either return the first value of the first set of results OR it will return the number of rows that were effected depending on whether or not the query was a select or not.

Installation

The library is available via Nuget with the package name "SQLHelper.DB". To install it run the following command in the Package Manager Console:

Install-Package SQLHelper.DB

Build Process

In order to build the library you will require the following as a minimum:

  1. Visual Studio 2022

Other than that, just clone the project and you should be able to load the solution and build without too much effort.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on SQLHelper.DB:

Package Downloads
Data.Modeler

Data.Modeler helps to model database schemas using C#.

Holmes

Holmes is a database analysis library designed to suggest improvements and optimizations. Supports .Net Core as well as full .Net.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
5.0.32 134 4/10/2025
5.0.30 219 3/15/2025
5.0.28 259 2/24/2025
5.0.27 276 2/12/2025
5.0.25 284 2/3/2025
5.0.24 253 1/30/2025
5.0.23 172 1/29/2025
5.0.22 222 1/24/2025
5.0.21 199 1/22/2025
5.0.20 206 1/16/2025
5.0.19 118 1/15/2025
5.0.15 162 1/13/2025
5.0.14 165 1/9/2025
5.0.13 382 12/17/2024
5.0.12 246 12/10/2024
5.0.11 107 12/10/2024
5.0.10 101 12/10/2024
5.0.9 155 12/9/2024
5.0.8 317 11/26/2024
5.0.7 97 11/26/2024
5.0.6 238 11/24/2024
5.0.5 105 11/24/2024
5.0.4 133 11/23/2024
4.0.218 191 11/20/2024
4.0.217 135 11/12/2024
4.0.216 271 11/11/2024
4.0.215 161 11/6/2024
4.0.214 232 11/5/2024
4.0.213 158 11/4/2024
4.0.212 172 11/1/2024
4.0.211 155 10/31/2024
4.0.210 155 10/30/2024
4.0.209 151 10/29/2024
4.0.208 208 10/25/2024
4.0.207 225 10/21/2024
4.0.206 201 10/16/2024
4.0.205 212 10/11/2024
4.0.204 161 10/10/2024
4.0.203 157 10/9/2024
4.0.202 235 10/2/2024
4.0.201 168 10/1/2024
4.0.200 195 9/30/2024
4.0.199 226 9/24/2024
4.0.198 189 9/23/2024
4.0.197 241 9/17/2024
4.0.196 247 9/10/2024
4.0.195 243 9/6/2024
4.0.194 257 9/3/2024
4.0.193 238 8/30/2024
4.0.192 183 8/29/2024
4.0.191 178 8/28/2024
4.0.190 189 8/27/2024
4.0.189 204 8/26/2024
4.0.188 207 8/23/2024
4.0.187 272 8/21/2024
4.0.186 380 8/16/2024
4.0.185 188 8/15/2024
4.0.184 199 8/14/2024
4.0.183 192 8/5/2024
4.0.182 157 8/2/2024
4.0.181 176 8/1/2024
4.0.180 248 7/26/2024
4.0.179 190 7/24/2024
4.0.178 249 7/11/2024
4.0.177 182 7/10/2024
4.0.176 120 7/10/2024
4.0.175 205 7/9/2024
4.0.174 310 7/5/2024
4.0.173 232 7/2/2024
4.0.172 278 6/27/2024
4.0.171 188 6/26/2024
4.0.170 259 6/24/2024
4.0.169 1,112 6/19/2024
4.0.168 198 6/18/2024
4.0.167 203 6/17/2024
4.0.166 210 6/14/2024
4.0.165 182 6/13/2024
4.0.164 308 6/3/2024
4.0.163 207 5/31/2024
4.0.162 202 5/30/2024
4.0.161 189 5/29/2024
4.0.160 348 5/27/2024
4.0.159 246 5/23/2024
4.0.158 257 5/21/2024
4.0.157 230 5/17/2024
4.0.156 190 5/16/2024
4.0.155 192 5/15/2024
4.0.154 240 5/8/2024
4.0.153 201 5/7/2024
4.0.152 214 5/6/2024
4.0.151 197 5/3/2024
4.0.150 733 5/2/2024
4.0.149 216 5/1/2024
4.0.148 206 4/30/2024
4.0.147 243 4/29/2024
4.0.146 226 4/25/2024
4.0.145 291 4/16/2024
4.0.144 214 4/12/2024
4.0.143 178 4/12/2024
4.0.142 202 4/11/2024
4.0.141 218 4/10/2024
4.0.140 198 4/9/2024
4.0.139 274 4/1/2024
4.0.138 241 3/29/2024
4.0.137 231 3/26/2024
4.0.136 215 3/22/2024
4.0.135 122 3/22/2024
4.0.134 260 3/18/2024
4.0.133 206 3/15/2024
4.0.132 189 3/14/2024
4.0.131 226 3/13/2024
4.0.130 220 3/11/2024
4.0.129 199 3/8/2024
4.0.128 171 3/7/2024
4.0.127 144 3/6/2024
4.0.126 155 3/5/2024
4.0.125 156 3/4/2024
4.0.124 1,263 3/1/2024
4.0.123 211 2/29/2024
4.0.122 120 2/28/2024
4.0.121 160 2/27/2024
4.0.120 310 2/26/2024
4.0.119 124 2/23/2024
4.0.118 150 2/22/2024
4.0.117 133 2/21/2024
4.0.116 147 2/20/2024
4.0.115 131 2/20/2024
4.0.114 748 2/19/2024
4.0.113 140 2/19/2024
4.0.112 215 2/16/2024
4.0.111 129 2/15/2024
4.0.110 154 2/14/2024
4.0.109 333 2/13/2024
4.0.108 208 2/12/2024
4.0.107 150 2/9/2024
4.0.106 240 2/8/2024
4.0.105 121 2/7/2024
4.0.104 111 2/7/2024
4.0.103 121 2/6/2024
4.0.102 701 2/2/2024
4.0.101 176 2/1/2024
4.0.100 127 2/1/2024
4.0.99 131 1/31/2024
4.0.98 126 1/30/2024
4.0.97 462 1/25/2024
4.0.96 176 1/24/2024
4.0.95 134 1/23/2024
4.0.94 1,209 1/16/2024
4.0.93 126 1/16/2024
4.0.92 213 1/15/2024
4.0.91 220 1/12/2024
4.0.90 133 1/11/2024
4.0.89 136 1/10/2024
4.0.88 499 1/8/2024
4.0.87 602 12/26/2023
4.0.86 125 12/26/2023
4.0.85 132 12/25/2023
4.0.84 375 12/22/2023
4.0.83 315 12/15/2023
4.0.82 131 12/14/2023
4.0.81 114 12/14/2023
4.0.80 153 12/13/2023
4.0.79 133 12/12/2023
4.0.78 830 12/11/2023
4.0.77 307 12/6/2023
4.0.76 263 12/5/2023
4.0.75 418 11/24/2023
4.0.74 287 11/21/2023
4.0.73 255 11/20/2023
4.0.72 205 11/20/2023
4.0.71 231 11/17/2023
4.0.70 682 11/16/2023
4.0.69 212 11/14/2023
4.0.68 299 11/9/2023
4.0.67 250 11/8/2023
4.0.66 215 11/7/2023
4.0.65 212 11/6/2023
4.0.64 220 11/3/2023
4.0.63 308 11/1/2023
4.0.62 137 11/1/2023
4.0.61 251 10/31/2023
4.0.60 230 10/30/2023
4.0.59 222 10/27/2023
4.0.58 210 10/26/2023
4.0.57 219 10/25/2023
4.0.56 219 10/17/2023
4.0.55 274 10/16/2023
4.0.54 298 10/12/2023
4.0.53 212 10/11/2023
4.0.52 260 10/5/2023
4.0.51 301 9/26/2023
4.0.50 298 9/22/2023
4.0.49 222 9/20/2023
4.0.48 205 9/19/2023
4.0.47 131 9/19/2023
4.0.46 257 9/18/2023
4.0.45 298 9/14/2023
4.0.44 220 9/13/2023
4.0.43 222 9/12/2023
4.0.42 260 9/11/2023
4.0.41 150 9/11/2023
4.0.40 218 9/11/2023
4.0.39 385 9/7/2023
4.0.38 223 9/6/2023
4.0.37 279 9/5/2023
4.0.36 163 9/5/2023
4.0.35 256 9/4/2023
4.0.34 296 9/1/2023
4.0.33 280 8/31/2023
4.0.32 247 8/30/2023
4.0.31 152 8/30/2023
4.0.30 278 8/29/2023
4.0.29 407 8/25/2023
4.0.28 341 8/23/2023
4.0.27 347 8/18/2023
4.0.26 232 8/17/2023
4.0.25 142 8/17/2023
4.0.24 149 8/17/2023
4.0.23 460 8/10/2023
4.0.22 255 8/9/2023
4.0.21 232 8/8/2023
4.0.20 170 8/8/2023
4.0.19 308 8/8/2023
4.0.18 374 8/7/2023
4.0.17 464 8/3/2023
4.0.16 396 7/26/2023
4.0.15 364 7/20/2023
4.0.14 370 7/18/2023
4.0.13 174 7/18/2023
4.0.12 161 7/18/2023
4.0.11 598 7/17/2023
4.0.10 175 7/14/2023
4.0.9 174 7/13/2023
4.0.8 164 7/13/2023
4.0.7 180 7/12/2023
4.0.6 175 7/12/2023
4.0.5 229 6/13/2023
4.0.4 1,024 1/30/2023
4.0.3 540 1/30/2023
4.0.2 544 1/27/2023
4.0.1 715 12/13/2022
4.0.0 528 12/12/2022
3.1.49 2,690 6/10/2022
3.1.47 1,830 4/20/2022
3.1.46 816 2/25/2022
3.1.45 2,028 1/11/2022
3.1.44 1,097 1/10/2022
3.1.43 1,153 10/12/2021
3.1.42 472 10/12/2021
3.1.41 1,695 6/17/2021
3.1.40 1,291 6/16/2021
3.1.39 1,174 6/16/2021
3.1.38 988 6/16/2021
3.1.37 756 6/15/2021
3.1.35 1,938 1/7/2021
3.1.34 1,398 12/16/2020
3.1.33 594 12/16/2020
3.1.32 1,204 12/14/2020
3.1.31 3,237 9/13/2020
3.1.30 1,721 6/19/2020
3.1.29 1,175 6/8/2020
3.1.28 2,469 5/12/2020
3.1.27 1,948 5/12/2020
3.1.26 1,463 4/28/2020
3.1.25 1,417 4/16/2020
3.1.23 1,368 4/16/2020
3.1.22 1,409 4/16/2020
3.1.21 1,147 4/15/2020
3.1.20 1,373 4/15/2020
3.1.19 1,448 4/14/2020
3.1.18 1,148 4/14/2020
3.1.17 634 4/14/2020
3.1.16 1,448 4/10/2020
3.1.15 1,465 4/10/2020
3.1.14 3,897 3/26/2020
3.1.13 1,483 3/26/2020
3.1.12 1,669 3/25/2020
3.1.11 1,156 3/25/2020
3.1.10 1,144 3/25/2020
3.1.9 1,588 3/25/2020
3.1.8 1,664 3/24/2020
3.1.7 2,280 3/21/2020
3.1.6 2,177 3/13/2020
3.1.5 1,175 3/13/2020
3.1.3 2,139 2/28/2020
3.1.1.2 638 2/28/2020
3.1.1 958 2/22/2020
3.1.0 1,199 2/21/2020
3.0.4 1,259 2/11/2020
3.0.3 920 2/11/2020
3.0.2 708 2/10/2020
3.0.1 1,664 1/9/2020
3.0.0 1,409 12/23/2019
2.0.18 2,628 6/19/2019
2.0.17 719 6/19/2019
2.0.16 2,141 4/17/2019
2.0.15 1,570 3/14/2019
2.0.14 779 2/22/2019
2.0.13 1,775 2/21/2019
2.0.12 755 2/21/2019
2.0.11 4,543 8/1/2018
2.0.10 1,720 8/1/2018
2.0.9 1,424 7/3/2018
2.0.8 1,899 6/26/2018
2.0.7 1,148 6/26/2018
2.0.6 1,694 6/14/2018
2.0.5 1,786 6/1/2018
2.0.4 2,077 5/22/2018
2.0.3 2,693 5/9/2018
2.0.2 2,362 2/15/2018
2.0.1 2,008 2/13/2018
2.0.0 2,724 1/2/2018
1.0.44 11,296 10/10/2017
1.0.42 1,016 10/10/2017
1.0.41 1,326 9/29/2017
1.0.40 4,309 9/19/2017
1.0.39 1,039 9/15/2017
1.0.36 1,029 9/15/2017
1.0.35 1,013 9/15/2017
1.0.34 3,286 7/3/2017
1.0.33 1,888 6/16/2017
1.0.32 1,843 6/16/2017
1.0.31 1,081 5/30/2017
1.0.28 1,732 5/30/2017
1.0.27 1,531 5/25/2017
1.0.26 1,802 5/24/2017
1.0.25 1,386 5/19/2017
1.0.24 1,074 5/19/2017
1.0.23 1,368 5/17/2017
1.0.20 1,173 5/8/2017
1.0.19 1,218 4/7/2017
1.0.18 1,776 3/22/2017
1.0.15 1,514 1/31/2017
1.0.14 1,198 1/24/2017
1.0.13 1,214 1/8/2017
1.0.12 1,183 1/6/2017
1.0.11 1,203 1/6/2017
1.0.10 1,171 1/3/2017
1.0.9 1,297 12/9/2016
1.0.8 1,122 12/1/2016
1.0.0 1,108 9/15/2017