string strSql="select id,sysdate,name,lianxi,wentilist,wenti,youxian,haoma,ipaddress,chuli from login where 1=1 ";
if(name1!="")
{
strSql+=" and name like '%"+name1+"%'";
}
if(this.Dp1.SelectedIndex>0)
{
strSql+=" and wentilist='"+name2+"'";
}
这样查出来的是按时间的顺序排列的,我想让它按时间倒序排列啊,请问应该怎么弄??

解决方案 »

  1.   

    这样应该是按ID顺序来的 按时间用 order by
      

  2.   

    strSql+=" order by sysdate desc'
      

  3.   

    order by 时间  desc
      

  4.   

    最后加上strSql+=" order by sysdate"
      

  5.   

    最后再来句strSql+=" order by sysdate desc"
      

  6.   

    strSql+=" order by sysdate desc"后面
      

  7.   

    加最后面
    完整应该是这样
    string strSql="select id,sysdate,name,lianxi,wentilist,wenti,youxian,haoma,ipaddress,chuli from login where 1=1 ";
    if(name1!="")
    {
    strSql+=" and name like '%"+name1+"%'";
    }
    if(this.Dp1.SelectedIndex>0)
    {
    strSql+=" and wentilist='"+name2+"'";
    }
    strSql+=" Order By sysdate desc"
      

  8.   

    加最后面
    完整应该是这样
    string strSql="select id,sysdate,name,lianxi,wentilist,wenti,youxian,haoma,ipaddress,chuli from login where 1=1 ";
    if(name1!="")
    {
    strSql+=" and name like '%"+name1+"%'";
    }
    if(this.Dp1.SelectedIndex>0)
    {
    strSql+=" and wentilist='"+name2+"'";
    }
    strSql+=" Order By sysdate desc"
    我就是按这样弄的,结果为什么有时好,有时出现错误,在IE7上就没问题
      

  9.   

    加最后面
    完整应该是这样
    string strSql="select id,sysdate,name,lianxi,wentilist,wenti,youxian,haoma,ipaddress,chuli from login where 1=1 ";
    if(name1!="")
    {
    strSql+=" and name like '%"+name1+"%'";
    }
    if(this.Dp1.SelectedIndex>0)
    {
    strSql+=" and wentilist='"+name2+"'";
    }
    strSql+=" Order By sysdate desc"
    我就是按这样弄的,结果为什么有时好,有时出现错误,在IE7上就没问题