ds.Tables[0].DefaultView.Sort="id desc";因为在XML中,ID是字符串类型,所以在dataGrid里显示出现问题:
5
4
3
16
15
12
11实际上应该排序是:
16
15
12
11
5
4
3这个问题如何解决?怎么样才能把ID转换为int类型排序呢?
5
4
3
16
15
12
11实际上应该排序是:
16
15
12
11
5
4
3这个问题如何解决?怎么样才能把ID转换为int类型排序呢?
解决方案 »
- 新建达特提么对象
- 求用户数量控制的思路
- 多个邮政编码的验证
- C#如何打开OLE附件格式的文件,如Word,excel
- c如何构建多(模块)dll程序
- 两个Double[][]类型的数组array1, array2, 要把array2拷贝给array1, array1 = array2这样不行吗?
- 水晶报表 Crystal Reports XI 求个免费下载地址??????
- 在C#中怎么样比较时间啊
- 精通COM互操作的牛进来吃草了!偶会把http://expert.csdn.net/Expert/TopicView1.asp?id=2408875的100分也给你。
- 关于vs生成exe的图标大小问题
- 在编写com+组件遇到“分布式事务已完成。请将此会话登记到新事务或 NULL 事务中。”
- Winform 中,怎样枚举目前已经打开的窗体?
datacolumn IntID = newdatacolumn("IntID ",typeof(int));
IntID .expresssion = "Convert(int, id)";
ds.Tables[0].DefaultView.Sort="IntID desc";
试试吧
datacolumn IntID = new datacolumn("IntID ",typeof(int));
IntID .expresssion = "Convert(int, id)";
ds.Tables[0].DefaultView.Sort="IntID desc";
试试吧
IntID .expresssion = "Convert(int, id)";
ds.Tables[0].Columns.Add(IntID );
ds.Tables[0].DefaultView.Sort="IntID desc";
红色提示:ds.Tables[0].Columns.Add(IntID);这行错误
foreach(XmlNode xn in nodeList)//遍历子节点想问一下foreach如何倒序?或者如果用for如何写?
for(int i=nodeList.Count;i>0;i--)
{
//我这么写竟然
//nodeList[i] 函数“nodeList.get_ItemOf”已求值并返回空
//xn <未定义的值>
XmlNode xn = nodeList[i];
....
}哭!!!到处碰壁!
DataColumn IntID = new DataColumn("IntID", typeof(int));
IntID.Expression = "Convert(ID, 'System.Int32')";
ds.Tables[0].Columns.Add(IntID);
ds.Tables[0].DefaultView.Sort = "IntID desc";
也就是
for(int i=nodeList.Count-1;i>=0;i--)
{
//todo
}