UtilityPack.Database
1.1.10
See the version list below for details.
dotnet add package UtilityPack.Database --version 1.1.10
NuGet\Install-Package UtilityPack.Database -Version 1.1.10
<PackageReference Include="UtilityPack.Database" Version="1.1.10" />
paket add UtilityPack.Database --version 1.1.10
#r "nuget: UtilityPack.Database, 1.1.10"
// Install UtilityPack.Database as a Cake Addin #addin nuget:?package=UtilityPack.Database&version=1.1.10 // Install UtilityPack.Database as a Cake Tool #tool nuget:?package=UtilityPack.Database&version=1.1.10
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 databaseTestConnection( 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 DataTableExecuteSqlCommand( 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 stringreturnNull : bool
If true, allow the function to return null if database value is nulldecimalDiv : string
Specify the division simbol if the value is a float and must be returned as a stringdecimalNumber : 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 | Versions 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. |
-
.NETStandard 2.0
- FirebirdSql.Data.FirebirdClient (>= 8.5.4)
- System.Data.SqlClient (>= 4.8.3)
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 | 147 | 1/11/2024 |
1.1.10 | 425 | 5/20/2022 |
1.1.9 | 381 | 5/20/2022 |
1.1.8 | 394 | 5/16/2022 |
1.1.7 | 415 | 4/5/2022 |
1.1.6 | 419 | 3/29/2022 |
1.1.5 | 425 | 2/10/2022 |
1.1.4 | 402 | 2/10/2022 |
1.1.3 | 392 | 2/10/2022 |
1.1.2 | 412 | 2/10/2022 |
1.1.1 | 407 | 2/9/2022 |
1.1.0 | 412 | 2/4/2022 |
1.0.2 | 411 | 1/31/2022 |
1.0.1 | 264 | 12/23/2021 |
1.0.0 | 287 | 11/17/2021 |