日期:2014-05-17 浏览次数:20749 次
db_2008Entities db = new db_2008Entities();
var QueryResults = from n in db.cup
select n;
foreach (var d in QueryResults)
{
Console.Write(d.area + " " + d.Price + " " + d.ID + "\t");
}
Console.WriteLine("\n============================================");
using (db_2008DataSetTableAdapters.cupTableAdapter adapter = new db_2008DataSetTableAdapters.cupTableAdapter())
{
using (db_2008DataSet.cupDataTable dbSet = new db_2008DataSet.cupDataTable())
{
adapter.Fill(dbSet);
Console.WriteLine("Row: {0}", dbSet.Rows.Count);
//为啥只有一行数据
foreach (DataRow n in dbSet.Rows)
{
Console.Write(n[1] + " " + n[2] + " " + n[0] + "\r");
}
}
}
Console.ReadKey();
}