//try.. create table #temp(num varchar(50)) insert into #temp select '3.3GB' union all select '523.6MB' union all select '823.5KB' select * from #temp order by num descselect * from #temp order by case when charindex('GB',num)>0 then convert(decimal,substring(num,1,charindex('GB',num)-1))*1024*1024 when charindex('MB',num)>0 then convert(decimal,substring(num,1,charindex('MB',num)-1))*1024 end descdrop table #temp /* 3.3GB 523.6MB 823.5KB */
button 的click 的参数在cs文件中写的很清楚的啊,你传入一个1是什么情况呢?
在CS中相应的事件中,通过Convert.ToInt32(e.CommandArgument)取参数
//try..
create table #temp(num varchar(50))
insert into #temp
select '3.3GB' union all
select '523.6MB' union all
select '823.5KB'
select * from #temp order by num descselect * from #temp order by
case when charindex('GB',num)>0 then convert(decimal,substring(num,1,charindex('GB',num)-1))*1024*1024
when charindex('MB',num)>0 then convert(decimal,substring(num,1,charindex('MB',num)-1))*1024 end descdrop table #temp
/*
3.3GB
523.6MB
823.5KB
*/