NTDLS.SqlManagedConnectivity 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package NTDLS.SqlManagedConnectivity --version 1.0.0
                    
NuGet\Install-Package NTDLS.SqlManagedConnectivity -Version 1.0.0
                    
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="NTDLS.SqlManagedConnectivity" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NTDLS.SqlManagedConnectivity" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="NTDLS.SqlManagedConnectivity" />
                    
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 NTDLS.SqlManagedConnectivity --version 1.0.0
                    
#r "nuget: NTDLS.SqlManagedConnectivity, 1.0.0"
                    
#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=NTDLS.SqlManagedConnectivity&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=NTDLS.SqlManagedConnectivity&version=1.0.0
                    
Install as a Cake Tool

NTDLS.SqlManagedConnectivity

📦 Be sure to check out the NuGet pacakge: https://www.nuget.org/packages/NTDLS.SqlManagedConnectivity

Wraps a native SQL Server connection, allows for easy field/value enumeration and manages cleanup.

Simple example:

In this example we are opening a connection to the local SQL Server (".") and the database ("Dummyload"), then selecting all rows and columns from the table [Test]. This demonstrates how we can enumaerate the fields and their types as well as the rows and their values with several options for conversion.

using (var connection = new SqlManagedConnection(".", "Dummyload"))
{
    using (var reader = connection.ExecuteQuery("SELECT * FROM Test"))
    {
        //Loop through all fields:
        foreach (var field in reader.Fields)
        {
            Console.WriteLine($"Field: '{field.Name}', Data Type: '{field.DataTypeName}', Type: '{field.Type.Name}'");
        }

        //Loop though all rows:
        foreach (var row in reader)
        {
            //Loop though all values in the row:
            foreach (var value in row)
            {
                Console.WriteLine($"{value.Field.Name} -> '{value.Value.ToString()?.Trim()}'");
            }

            var doublePercentTaxable = row.AsDouble("PercentTaxable");
            var decimalPercentTaxable = row.AsDecimal("OriginalAmount");
            var stringPercentTaxable = row.AsString("OriginalAmount");
            var intPercentTaxable = row.AsInt("OriginalAmount");
        }
    }
}

License

Apache-2.0

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

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
1.3.3 100 5/2/2025
1.3.2 140 12/31/2024
1.3.1 126 12/3/2024
1.3.0 153 7/3/2024
1.2.1 275 12/5/2023
1.2.0 173 12/5/2023
1.1.0 166 12/5/2023
1.0.0 168 12/5/2023

Initial release.