![]() |
VOOZH | about |
dotnet add package PublicUtility.Sql --version 2.0.0
NuGet\Install-Package PublicUtility.Sql -Version 2.0.0
<PackageReference Include="PublicUtility.Sql" Version="2.0.0" />
<PackageVersion Include="PublicUtility.Sql" Version="2.0.0" />Directory.Packages.props
<PackageReference Include="PublicUtility.Sql" />Project file
paket add PublicUtility.Sql --version 2.0.0
#r "nuget: PublicUtility.Sql, 2.0.0"
#:package PublicUtility.Sql@2.0.0
#addin nuget:?package=PublicUtility.Sql&version=2.0.0Install as a Cake Addin
#tool nuget:?package=PublicUtility.Sql&version=2.0.0Install as a Cake Tool
Class library with SQL manipulation facilitator in multiple database types
To install, just run the C# compiler to generate the .dll file and once the file has been generated, just add the reference to the project or use Nuget or in nuget console, use the following command:
install-Package PublicUtility.Sql
Class used for work with sql server database. Simplified methods that use sql transaction to complete activities securely. Below are examples of usage.
using PublicUtility.Sql.SqlServer;
// ************* USE EXAMPLE 1 ************
using var conn = DB.GetConn("myConnString"); // opens a new Sql server connection
var query = new StringBuilder();
var cmd = new SqlCommand();
query.AppendLine("SELECT * FROM MYTABLE");
query.AppendLine("WHERE ID = @ID");
cmd.CommandText = query.ToString();
cmd.Parameters.AddWithValue("ID", 10);
var dataTable = conn.ReturnData(cmd);
// ************* USE EXAMPLE 2 ************
using var conn = DB.GetConn("myConnString"); // opens a new Sql server connection
var query = "UPDATE MY TABLE SET NAME = NEWNAME WHERE ID = @ID";
var cmd = new SqlCommand();
cmd.CommandText = query.ToString();
cmd.Parameters.AddWithValue("ID", 10);
cmd.Parameters.AddWithValue("NEWNAME", "IS A TEST NAME");
conn.ExecCmd(cmd);
// ************* USE EXAMPLE 3 ************
using var conn = DB.GetConn("myConnString"); // opens a new Sql server connection
var query = "SELECT * FROM MYTABLE";
var dataTable = conn.ReturnData(query);
using PublicUtility.Sql.MySql;
// CONFIGURATION FOR CONNECTING TO THE SERVER.
var builder = new MySqlConnectionStringBuilder() {
Server = "localhost",
Database = "dbmysql",
UserID = "root",
Password = "",
Port = 3306,
SslMode = MySqlSslMode.Required
};
// ************* USE EXAMPLE 1 ************
using var con = DB.GetConn(builder);
var dataTable = con.ReturnData("SELECT * FROM DBTESTE");
// ************* USE EXAMPLE 2 ************
using var con = DB.GetConn(builder);
var resultOk = con.ExecQuery("INSERT INTO dbTeste VALUES(default, 'test')");
// ************* USE EXAMPLE 2 ************
using var con = DB.GetConn(builder);
var query = new StringBuilder();
var cmd = new MySqlCommand();
query.Append("INSERT INTO DBTESTE VALUES ");
query.Append(" (@default, @name01)");
query.Append(", (@default, @number01)");
cmd.CommandText = query.ToString();
cmd.Parameters.AddWithValue("name01", "test01");
cmd.Parameters.AddWithValue("number01", 010101);
cmd.Parameters.AddWithValue("default", default);
var resultOk = con.ExecCmd(cmd);
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net7.0 net7.0 is compatible. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
Inclusion of the Postegresql module, inclusion of async methods.