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 1 value FROM SalesOrderDetail";
SqlDataAdapter da = new SqlDataAdapter(sqlSelect, sqlConnectString);
DataTable dt = new DataTable( );
da.Fill(dt);
foreach (DataRow row in dt.Rows)
Console.WriteLine("SalesOrderDetailID = {0}, LineTotal = {1}, " +
"ExtendedPrice = {2}", row["SalesOrderDetailID"],
row["LineTotal"], row["ExtendedPrice"]);
}
}
|