Here is an example of the principles of ADO.Net
pseudocode
...
Sqldataadapter custAdapter = new SqlDataAdapter("SELECT * FROM Customers", thisConnection);
custAdapter.Fill(thisDataSet, "Customers");
foreach (DataRow custRow in thisDataSet.Tables["CustomerID"].Rows)
{
if (custRow["City"].ToString() == "Madrid")
{
Console.WriteLine("Customer ID: " + custRow["CustomerID"]);
}
}
Hope this helps.