SDO_dotNET 1.2.0

The SDO_dotNET Class Library is a high level wrapper around the ODBC, OLEDB, SQLServer, MySQL and SQLite.

The SQL Data Objects (PDO) extension defines a lightweight, consistent interface for accessing databases in .NET.
Each database driver that implements the PDO interface can expose database-specific features as regular extension functions.
Note that you cannot perform any database functions using the PDO extension by itself; you must use a database-specific PDO driver to access a database server.

PDO provides a data-access abstraction layer, which means that, regardless of which database you're using, you use the same functions to issue queries and fetch data.
PDO does not provide a database abstraction; it doesn't rewrite SQL or emulate missing features. You should use a full-blown abstraction layer if you need that facility.

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

Install-Package SDO_dotNET -Version 1.2.0
dotnet add package SDO_dotNET --version 1.2.0
<PackageReference Include="SDO_dotNET" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SDO_dotNET --version 1.2.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SDO_dotNET, 1.2.0"
For F# scripts that support #r syntax, copy this into the source code to reference the package.

private static void TestMySql()
{
/******************************************************************
* MySQL
*******************************************************************/

string server = "localhost";
string database = "DEMODB";
string username = "root";
string password = "";

string connectionString = @"Data Source=" + server + "; Database=" + database + "; User ID=" + username + "; Password=" + password + ";";

//SDO db_conn = new SDO(connectionString);
SDO db_conn = new SDO(new MySqlConnection(connectionString));

Console.WriteLine("IsConnected: " + db_conn.IsConnected());
if (db_conn == null || !db_conn.IsConnected())
{
	Console.WriteLine("Connessione non valida.");
	Console.ReadLine();
	return;
}

string sql;
sql = "SELECT name, surname, email FROM users " +
	  "ORDER BY name;";
DataTable dtUsers = db_conn.SelectTable(sql);

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

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

}

private static void TestSqlServer()
{
/******************************************************************
* Sql Server
*******************************************************************/

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 + ";Connect Timeout=60";

//SDO db_conn = new SDO(connectionString);
SDO db_conn = new SDO(new SqlConnection(connectionString));

Console.WriteLine("IsConnected: " + db_conn.IsConnected());
if (db_conn == null || !db_conn.IsConnected())
{
	Console.WriteLine("Connessione non valida.");
	Console.ReadLine();
	return;
}

string sql = "SELECT TOP 10 ID, Message FROM Log4NetLog 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());
}

}

private static void TestSQLite()
{
/******************************************************************
* SQLite
*******************************************************************/

string database = @"C:\Users\Utente\mydb.sqlite";

string connectionString = @"Data Source=" + database + "; Version=3; New=True; Compress=True;"; // local
SDO db_conn = new SDO(connectionString);

Console.WriteLine("IsConnected: " + db_conn.IsConnected());
if (db_conn == null || !db_conn.IsConnected())
{
	Console.WriteLine("Connessione non valida.");
	Console.ReadLine();
	return;
}

string sql = "SELECT firstname, surname FROM users ORDER BY firstname;";
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("Name: " + dr["firstname"].ToString().Trim() + " " + dr["surname"].ToString().Trim());
}

}

private static void TestMySql()
{
/******************************************************************
* MySQL
*******************************************************************/

string server = "localhost";
string database = "DEMODB";
string username = "root";
string password = "";

string connectionString = @"Data Source=" + server + "; Database=" + database + "; User ID=" + username + "; Password=" + password + ";";

//SDO db_conn = new SDO(connectionString);
SDO db_conn = new SDO(new MySqlConnection(connectionString));

Console.WriteLine("IsConnected: " + db_conn.IsConnected());
if (db_conn == null || !db_conn.IsConnected())
{
	Console.WriteLine("Connessione non valida.");
	Console.ReadLine();
	return;
}

string sql;
sql = "SELECT name, surname, email FROM users " +
	  "ORDER BY name;";
DataTable dtUsers = db_conn.SelectTable(sql);

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

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

}

private static void TestSqlServer()
{
/******************************************************************
* Sql Server
*******************************************************************/

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 + ";Connect Timeout=60";

//SDO db_conn = new SDO(connectionString);
SDO db_conn = new SDO(new SqlConnection(connectionString));

Console.WriteLine("IsConnected: " + db_conn.IsConnected());
if (db_conn == null || !db_conn.IsConnected())
{
	Console.WriteLine("Connessione non valida.");
	Console.ReadLine();
	return;
}

string sql = "SELECT TOP 10 ID, Message FROM Log4NetLog 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());
}

}

private static void TestSQLite()
{
/******************************************************************
* SQLite
*******************************************************************/

string database = @"C:\Users\Utente\mydb.sqlite";

string connectionString = @"Data Source=" + database + "; Version=3; New=True; Compress=True;"; // local
SDO db_conn = new SDO(connectionString);

Console.WriteLine("IsConnected: " + db_conn.IsConnected());
if (db_conn == null || !db_conn.IsConnected())
{
	Console.WriteLine("Connessione non valida.");
	Console.ReadLine();
	return;
}

string sql = "SELECT firstname, surname FROM users ORDER BY firstname;";
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("Name: " + dr["firstname"].ToString().Trim() + " " + dr["surname"].ToString().Trim());
}

}

Release Notes

SQL Data Object .NetFramework.

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
1.2.0 109 10/9/2020
1.1.0 92 9/27/2020
1.0.2 363 12/13/2018
1.0.1 312 12/9/2018