SQLServerDataProvider 1.4.1

dotnet add package SQLServerDataProvider --version 1.4.1
                    
NuGet\Install-Package SQLServerDataProvider -Version 1.4.1
                    
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="SQLServerDataProvider" Version="1.4.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SQLServerDataProvider" Version="1.4.1" />
                    
Directory.Packages.props
<PackageReference Include="SQLServerDataProvider" />
                    
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 SQLServerDataProvider --version 1.4.1
                    
#r "nuget: SQLServerDataProvider, 1.4.1"
                    
#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.
#:package SQLServerDataProvider@1.4.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SQLServerDataProvider&version=1.4.1
                    
Install as a Cake Addin
#tool nuget:?package=SQLServerDataProvider&version=1.4.1
                    
Install as a Cake Tool

SQLServerDataProvider

SQL Server Data Provider

Very simple to execute SQL query for SQL Server

Author

Tui Tên Tuấn - Professtional developer C#

Base on KTeam

Visit me at TuiTenTuan.com

Install

NuGet\Install-Package SQLServerDataProvider -Version 1.4.1

Github

Package.SQLServerDataProvider

Usage

Construction

Normal

string _connection = "Server=;Database=;User=;Password=;";
DataProvider dp = new DataProvider(_connection);

DI (in .Net core and .Net 6 or lasted)

.Net core 3.1 add this to ConfigureServices of Startup.cs file

string _connection = "Server=;Database=;User=;Password=;"; //Can get in appsettings.json

services.AddTransient<IDataProvider>(new DataProvider(_connection));

.Net 6 add this to the file Program.cs

string _connection = "Server=;Database=;User=;Password=;"; //Can get in appsettings.json

builder.Services.AddTransient<IDataProvider>(new DataProvider(_connection));

Use

Normal

# Excute Query to return DataTable
string query = "Select * from TempTable where id = @abc , name = @name";
object[] parameter = new object[] {"1", "abc"};
DataTable result = dp.ExcuteQuery(query, parameter);

# Excute non-Query to return the total row affected
string query = "Select * from TempTable where id = @abc , name = @name";
object[] parameter = new object[] {"1", "abc"};
int rowAffected = dp.ExcuteNonQuery(query, parameter);

# Excute Scalar query returns the value of the first column and first row as an object
string query = "Select * from TempTable where id = @abc , name = @name";
object[] parameter = new object[] {"1", "abc"};
int rowEffected = dp.ExcuteNonQuery(query, parameter);

DI (.Net core and .Net 6 or lasted)

Construction in class

public class TestClass
{
    private readonly IdataProvider _dp;

    public TestClass(IDataProvider dataProvider)
    {
        _dp = dataProvider;
    }
}

Use in class

# Excute Query to return DataTable
string query = "Select * from TempTable where id = @abc , name = @name";
object[] parameter = new object[] {"1", "abc"};
DataTable result = _dp.ExcuteQuery(query, parameter);

# Excute non-Query to return the total row affected
string query = "Select * from TempTable where id = @abc , name = @name";
object[] parameter = new object[] {"1", "abc"};
int rowAffected = _dp.ExcuteNonQuery(query, parameter);

# Excute Scalar query returns the value of the first column and first row as an object
string query = "Select * from TempTable where id = @abc , name = @name";
object[] parameter = new object[] {"1", "abc"};
int rowEffected = _dp.ExcuteNonQuery(query, parameter);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  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 was computed.  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. 
.NET Core netcoreapp3.1 is compatible. 
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.1

    • No dependencies.
  • .NETFramework 4.5

    • No dependencies.
  • net6.0

    • No dependencies.
  • net7.0

    • No dependencies.

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.4.1 466 2/15/2023
1.3.1 539 10/14/2022
1.2.1 486 10/14/2022
1.1.0 742 10/14/2022 1.1.0 is deprecated because it is no longer maintained and has critical bugs.
1.0.0 760 10/14/2022 1.0.0 is deprecated because it is no longer maintained and has critical bugs.