using System;
using System.Data;
using System.Data.SqlClient;
class Program
{
static void Main(string[] args)
{
string sqlConnectString = "Data Source=(local);Integrated security=SSPI;Initial Catalog=AdventureWorks;";
string sqlSelect = "SELECT TOP 5 * FROM Sales.SalesOrderDetail";
SqlDataAdapter da = new SqlDataAdapter(sqlSelect, sqlConnectString);
DataTable dt = new DataTable();
da.Fill(dt);
dt.Columns.Add(new DataColumn("ExtendedPrice", typeof(Decimal),
"UnitPrice * (1 - UnitPriceDiscount) * OrderQty"));
foreach (DataRow row in dt.Rows)
Console.WriteLine("ID = {0}, UnitPrice = {1}, " +
"Disc = {2}, Qty = {3}, Total = {4}",
row["SalesOrderDetailID"], row["UnitPrice"],
row["UnitPriceDiscount"], row["OrderQty"],
row["ExtendedPrice"]);
}
}