-
LINQ(Languge INtegrated Query)Platform/DB 2013. 12. 9. 23:50
닷넷 프레임워크 3.5
private void Form1_Load(object sender, EventArgs e)
{
Con = new SqlConnection();
Con.ConnectionString = "Server=..;database=..;Integrated Security=true";
Adpt = new SqlDataAdapter("SELECT * FROM tblPeople", Con);
tblPeople = new DataTable("tblPeople");
Adpt.Fill(tblPeople);
var tp = tblPeople.AsEnumerable();
var Q = from p in tp orderby p.Field<int>("Age") select p;
foreach (var p in Q)
{
.. p.ItemArray[0] .. p.ItemArray[1] .. p.ItemArray[2] ..
}
}