Perhaps an introduction to Microsoft's ADO.NET code, the System.Data.SqlClient
in particular if you are dealing with SQL Server. A quick example:
using (SqlConnection conn = new SqlConnection("YourConnectionStringToDatabaseHere"))
{
conn.Open();
// using a command to retrieve active orders
using (SqlCommand cmd = new SqlCommand("SELECT COUNT(id_pac) AS Expr1, data
FROM programare
GROUP BY data", conn))
{
// get a sqlreader with the results from our query
using (var reader = cmd.ExecuteReader())
{
// while there is a record to be read
while (reader.Read())
{
int index = 1;
var count = reader.GetInt32(index++);
var data = reader.GetString(index++);
}
}
}
}
I didn't get to test my code in particular, but it should give you an idea where to start.