SqlServerDB_dotNET 2.0.2

The SqlServerDB_dotNET Class Library is a high level wrapper around the SQLServer.

The library is currently compiled at .Net 4.0 so it should work with any application running .Net 4.0 and above.

Install-Package SqlServerDB_dotNET -Version 2.0.2
dotnet add package SqlServerDB_dotNET --version 2.0.2
<PackageReference Include="SqlServerDB_dotNET" Version="2.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SqlServerDB_dotNET --version 2.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SqlServerDB_dotNET, 2.0.2"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install SqlServerDB_dotNET as a Cake Addin
#addin nuget:?package=SqlServerDB_dotNET&version=2.0.2

// Install SqlServerDB_dotNET as a Cake Tool
#tool nuget:?package=SqlServerDB_dotNET&version=2.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Example:
using SqlServerDB;

string server = @"INSTANCE\SQLEXPRESS";
string database = "DEMODB";
string username = "sa";
string password = "";

string connectionString = @"Data Source="+ server + ";Initial Catalog="+ database + "; Trusted_Connection=True;User ID="+ username + ";Password="+ password + "";
DBConnection db_conn = new DBConnection(connectionString);

Console.WriteLine("IsConnected: " + db_conn.IsConnected());
if (db_conn == null || !db_conn.IsConnected())
{
Console.WriteLine("Connessione non valida.");
return;
}
Console.WriteLine("GetVersion: " + db_conn.GetVersion());
Console.WriteLine("ConnectionString: " + connectionString);
Console.WriteLine("GetConnectionTimeout: " + db_conn.GetConnectionTimeout());
Console.WriteLine("Host: " + db_conn.Server);
Console.WriteLine("Database: " + db_conn.Database);
Console.WriteLine("UserID: " + db_conn.UserID);
Console.WriteLine("Password: " + db_conn.Password);

string sql = "SELECT ID, Message FROM Logs ORDER BY IDLic;";
DataTable dtLogs = db_conn.SelectTable(sql);

if (dtLogs == null || dtLogs.Rows.Count == 0)
return;

// Loop with the foreach keyword.
foreach (DataRow dr in dtLogs.Rows)
{
Console.WriteLine("Message: " + dr["Message"].ToString().Trim());
}

using (DBConnection db_conn = new DBConnection(connectionString))
{
string sNominativo = "Micky";
string sql = "INSERT INTO TabLav (Nominativo) " +
"values('" + sNominativo + "');";

if (!db_conn.sql_query(sql))
{
	Console.WriteLine("Error during insert: " + db_conn.sql_error()[0]);
	Console.WriteLine(sql);
}

int insertedID = db_conn.GetLastInsertedRowID();
Console.WriteLine("GetLastInsertedRowID: " + insertedID);
int recordsAffected = db_conn.GetNumRecordsAffected();
Console.WriteLine("GetNumRecordsAffected: " + recordsAffected);

}

Example:
using SqlServerDB;

string server = @"INSTANCE\SQLEXPRESS";
string database = "DEMODB";
string username = "sa";
string password = "";

string connectionString = @"Data Source="+ server + ";Initial Catalog="+ database + "; Trusted_Connection=True;User ID="+ username + ";Password="+ password + "";
DBConnection db_conn = new DBConnection(connectionString);

Console.WriteLine("IsConnected: " + db_conn.IsConnected());
if (db_conn == null || !db_conn.IsConnected())
{
Console.WriteLine("Connessione non valida.");
return;
}
Console.WriteLine("GetVersion: " + db_conn.GetVersion());
Console.WriteLine("ConnectionString: " + connectionString);
Console.WriteLine("GetConnectionTimeout: " + db_conn.GetConnectionTimeout());
Console.WriteLine("Host: " + db_conn.Server);
Console.WriteLine("Database: " + db_conn.Database);
Console.WriteLine("UserID: " + db_conn.UserID);
Console.WriteLine("Password: " + db_conn.Password);

string sql = "SELECT ID, Message FROM Logs ORDER BY IDLic;";
DataTable dtLogs = db_conn.SelectTable(sql);

if (dtLogs == null || dtLogs.Rows.Count == 0)
return;

// Loop with the foreach keyword.
foreach (DataRow dr in dtLogs.Rows)
{
Console.WriteLine("Message: " + dr["Message"].ToString().Trim());
}

using (DBConnection db_conn = new DBConnection(connectionString))
{
string sNominativo = "Micky";
string sql = "INSERT INTO TabLav (Nominativo) " +
"values('" + sNominativo + "');";

if (!db_conn.sql_query(sql))
{
	Console.WriteLine("Error during insert: " + db_conn.sql_error()[0]);
	Console.WriteLine(sql);
}

int insertedID = db_conn.GetLastInsertedRowID();
Console.WriteLine("GetLastInsertedRowID: " + insertedID);
int recordsAffected = db_conn.GetNumRecordsAffected();
Console.WriteLine("GetNumRecordsAffected: " + recordsAffected);

}

Release Notes

Extensions on the SqlServerDB .NetFramework.

Dependencies

This package has 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 History

Version Downloads Last updated
2.0.2 62 2/9/2021
2.0.1 54 2/9/2021
2.0.0 67 2/7/2021
1.3.4 122 12/3/2020
1.3.3 181 11/2/2020
1.3.2 160 10/23/2020
1.3.1 138 10/13/2020
1.3.0 133 10/12/2020
1.2.2 196 10/1/2020
1.2.1 151 9/27/2020
1.2.0 194 9/20/2020
1.1.3 147 8/18/2020
1.1.2 127 8/17/2020
1.1.1 210 8/12/2020
1.1.0 144 8/12/2020
1.0.0 423 12/8/2018