当前位置:编程学习 > C#/ASP.NET >>

DataTable 排序

1)


[csharp]
dtVariable.DefaultView.Sort="VariableUsed asc"; 
dtVariable = dtVariable.DefaultView.ToTable(); 
foreach(DataRow tmpRow in dtVariable.Rows) 

    sbResult.AppendLine(tmpRow["ObjectName"].ToString() + ": VariableUsed=" + tmpRow["VariableUsed"]); 

dtVariable.DefaultView.Sort="VariableUsed asc";
dtVariable = dtVariable.DefaultView.ToTable();
foreach(DataRow tmpRow in dtVariable.Rows)
{
 sbResult.AppendLine(tmpRow["ObjectName"].ToString() + ": VariableUsed=" + tmpRow["VariableUsed"]);
}
2)

DataTable 使用sort和Distinct

http://blog.163.com/qingzi1107@126/blog/static/16958032620114422641653/


http://www.dotblogs.com.tw/tony1534/archive/2009/06/10/8771.aspx


 

补充:软件开发 , C# ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,