UtilityPack.Database 1.1.11

dotnet add package UtilityPack.Database --version 1.1.11
NuGet\Install-Package UtilityPack.Database -Version 1.1.11
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="UtilityPack.Database" Version="1.1.11" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add UtilityPack.Database --version 1.1.11
#r "nuget: UtilityPack.Database, 1.1.11"
#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.
// Install UtilityPack.Database as a Cake Addin
#addin nuget:?package=UtilityPack.Database&version=1.1.11

// Install UtilityPack.Database as a Cake Tool
#tool nuget:?package=UtilityPack.Database&version=1.1.11

Database

Enum DbSystem

  • SQL_SERVER
  • FIREBIRD

Class Database

An instance of this class equal to a connection to a Database.

Property

  • CommandTimeout : public int
    Time for every command to run before calling an error (Default=0, unlimited time)

  • system : {get public; set private} DbSystem
    Type of this database

Methods

  • ChangeDatabase( string name ) : void
    Change the connected database

  • TestConnection( bool print) : bool
    Return true if the connection succeed, false otherwise. If print is true, write the result on console.

  • ExecuteSqlQuery( string sql ) : DataTable
    Execute a query on the database and return the result in form of a DataTable

  • ExecuteSqlCommand( string sql ) : int
    Execute a command on the database, return the number of affected rows

Static Methods

  • ParseToNumber<T>(object value, T standard, DbParsingOption options) : T
    Parse a recived object from a query to a numeric value. "T" is the Type of numeric value to return. If something happen, return the value passed in "standard". To change the parsing behaviour customize the values of the "options" object.

  • ParseToString(Object value, string standard, DbParsingOption options) : string
    Parse a recived object from a query to a string. If something happen, return the value passed in "standard". To change the parsing behaviour customize the values of the "options" object.

Class DbParsingOption

Class used in static parse methods of Database class, to customize the parsing operation.

Property

  • trim : bool
    If true execute a trim on the obtained string

  • returnNull : bool
    If true, allow the function to return null if database value is null

  • decimalDiv : string
    Specify the division simbol if the value is a float and must be returned as a string

  • decimalNumber : int
    Specify the number of decimal values

Example

    // create the connection
    Database DB = new Database("VAULT", "localhost", "mario", "12345678", DbSystem.SQL_SERVER);

    //test the connection
    bool isConnected = DB.TestConnection(true);

    if(isConnected)
    {
        // create and execute the query
        string query = "SELECT name, age FROM users";

        DataTable result = DB.ExecuteSqlQuery(query);

        // if no results are found return
        if(result.Rows.Count <= 0)
            return;

        // get the result from first row and column "age"
        object value = result.Rows[0]["age"];

        // use the parse method to transform the value to int
        int firstUserAge = Database.ParseToNumber(value, 0);
    }
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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.1.11 107 1/11/2024
1.1.10 394 5/20/2022
1.1.9 352 5/20/2022
1.1.8 368 5/16/2022
1.1.7 386 4/5/2022
1.1.6 390 3/29/2022
1.1.5 391 2/10/2022
1.1.4 370 2/10/2022
1.1.3 365 2/10/2022
1.1.2 381 2/10/2022
1.1.1 377 2/9/2022
1.1.0 383 2/4/2022
1.0.2 378 1/31/2022
1.0.1 234 12/23/2021
1.0.0 259 11/17/2021