DataTable.DefaultView.Sort="StartNo,EndNo asc";
解决方案 »
- 为什么保存数据库的时候遇见这个问题
- 我问我的牛B同事,牛B同事丢了一句,字符转义,就不里我了,我还是不懂
- 关于一个复选框的问题
- GridView怎么实现跨表数据邦定
- 请问gridview在前台写那些连接数据库,绑定数据库的代码和写在后台有区别吗?
- 问点问题请帮帮我~
- 关于DropDownList空间的问题
- GridView 调用存储过程...点击分页伯..GridView没有了......
- beginning dump of physical memory~~~急!!!!!!!!!
- 进来看一下!!!
- linkbotton如何实现超联接?
- 再扔100分,问水晶报表10安装的简单问题,附下载地址,急!在线等!
不是对两个列分别排序
不能多加一列啊 因为我要根据这个表所做的修改 更新数据库的 tavor(龙双公子):
StartNo desc ,EndNo asc这样不行的
就连查询分析器 也行不通
1.select * from youtable order by StartNo desc,EndNo asc2.Use DataTable To Create DataViewDataSet ds=new DataSet();
SqlDataAdapter Da=new SqlDataAdapter("select * from youtable",ConnString);
Da.Fill(ds,"V_Table1");
/////
ds.Tables["V_Table1"].DefaultView.Sort="StartNo desc ,EndNo asc";
now you can do as caap2017 said.first,you use sql string like thisSqlDataAdapter sda=new SqlDataAdapter("select *,(max_lvl-min_lvl) as sort from jobs order by sort",myconnection);
sda.Fill(ds,"jobs");
this.DataGrid1.DataSource=ds.Tables[0].DefaultView;
this.DataGrid1.DataBind();you can dynamicly set the sortexpression like this:
ds.Tables[0].DefaultView.Sort="sort asc";then i think you should use boundcolumn ,then you don't bind the sort column.i think then you will get what you want to get.
Windows Forms versus Web Forms DataGrid Control
............
As with other Web server controls, it does not support two-way data binding. If you want to update data, you must write code to do this yourself.
.............i don't know it can be update database with the sqldataadpter.update() or not.so you must write the update code youself.