请教大侠:请问在网页上如何显示按时间排列呀?
我作得页面出现一下问题
2004-9-3,2004-9-1,2004-9-11,按升序按降序排得结果是:(2004-9-3;2004-9-11;2004-9-1)  (2004-9-1;2004-9-11;2004-9-3),这个显然不是按时间排列得。请问怎么处理呀??sub mydatagird_page(obj as object,e as datagridpagechangedeventargs)
  datagrid1.currentpageindex = e.newpageindex
  dim dspagedata as new dataset
  dim dbconn as oledbconnection
  dim dbcommand as oledbdataadapter
  dim DSN as string = "provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("ziyuan.mdb")&";"
  dbconn = new oledbconnection(DSN)
  dim tSQL as string = "select * from ziyuan where pinming like '%"+t+"%' order by shijian DESC"
  dbcommand = new oledbdataadapter(tSQL,dbconn)
  dbcommand.fill(dspagedata,"et")
  datagrid1.datasource=dspagedata.tables("et").defaultview
  datagrid1.databind()
end sub 
<asp:DataGrid id="DataGrid1" s。。

解决方案 »

  1.   

    我得发布资源得代码是:
    sub submitclick(obj as object,e as eventargs)
       if Page.IsValid="true" then
           dim DSN as string = "provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("ziyuan.mdb")&";"
           dim tSQL as string 
           dim mycon as new oledbConnection 
           mycon = new oledbConnection(DSN)
           mycon.open
           dim mycmd as oledbCommand
           dim strjiage as string = txtjiage.text
           if strjiage = "0" then
              strjiage = "面议"
           end if  
           
           tSQL="insert into ziyuan (pinming,comuid,comname,caizhi,guige,chandi,jiage,shuliang,cangku,shijian) values("
           tSQL=tSQL + "'" + txtpinming.text + "',"
           tSQL=tSQL + session("uid").tostring + ","
           tSQL=tSQL + "'" + session("comname") + "',"
           tSQL=tSQL + "'" + txtcaizhi.text + "',"
           tSQL=tSQL + "'" + txtguige.text + "',"
           tSQL=tSQL + "'" + txtchandi.text + "',"
           tSQL=tSQL + "'" + strjiage + "',"
           tSQL=tSQL + "'" + txtshuliang.text + "',"
           tSQL=tSQL + "'" + txtcangku.text + "',"
           tSQL=tSQL + "'" + now.date + "')"          mycmd = new oledbcommand(tSQL,mycon)
              mycmd.ExecuteNonQuery()
                     
              response.write("<" + "script language=javascript>alert('您的资源上传成功!')<" + "/script>")         mycon.close
            
            txtpinming.text=""
            txtcaizhi.text=""
            txtguige.text=""
            txtchandi.text=""
            txtjiage.text=""
            txtshuliang.text=""
            txtcangku.text=""
            
         end if
    end sub
      

  2.   

    在绑定的时候Format日期:
    <BoundColumn DataField="" DataFormatString="{0:yyyy-MM-dd}"></BoundCloumn>
      

  3.   

    dim tSQL as string = "select * from ziyuan where pinming like '%"+t+"%' 
    order by substring(Convert(varchar,shijian,120),0,11) DESC"
      

  4.   

    "select * from ziyuan where pinming like '%"+t+"%' order by shijian desc(小写)"
    这句写的没什么问题
    在我这调好使,你数据表中的时间字段用的是Datetime型吗?
      

  5.   

    在发布得页面绑定还是在显示得页面绑定????具体在哪里绑定呀?将这个代码查到哪:<BoundColumn DataField="" DataFormatString="{0:yyyy-MM-dd}"></BoundCloumn>
      

  6.   


     按照wangsaokui(无间道III(终极无间)) 大侠得方法出现一下问题:
    System.Data.OleDb.OleDbException: IErrorInfo.GetDescription failed with E_FAIL(0x80004005).
    Line 62:   dbcommand.fill(dspagedata,"et")
      

  7.   

    你数据表中的shijian字段用的是DateTime型吗?
      

  8.   

    如果shijian字段改成时间日期格式得话显示得就是2004-9-11 0:00:00了,我只要显示日期,后面得时间是怎么除掉呀?
      

  9.   

    多谢上面得大侠提醒,基本弄好了,但是::::
    我用now.date存入数据库时间。打开数据库看到是“2004-10-15”,但是在网页上显示得为什么是“2004-10-15  0:00:00”怎么样去掉后面得0:00:00?
      

  10.   

    ——————————
    在绑定的时候Format日期:
    <BoundColumn DataField="" DataFormatString="{0:d}"></BoundCloumn>
    ——————————
      

  11.   

    Sorry,没有看清楚是ACCESS,还以为是SQLSERVER
    <BoundColumn DataField="shijian" DataFormatString="{0:yyyy-MM-dd}"></BoundCloumn>
    替换你的datagird控件中绑定的时间列
      

  12.   

    修改格式化字符串:DataFormatString
      

  13.   

    多谢wangsaokui(无间道III(终极无间)) manbaum()
      

  14.   

    原贴内容:
    你好,我把数据库改为时间日期格式后,页面上显示得是2004-x-x 00:00;00,但是我只要显示日期,后面得时间怎么去掉呀?回复人: forestyang(forestyang) ( ) 信誉:100 
    在绑定的时候Format日期:
    <BoundColumn DataField="" DataFormatString="{0:yyyy-MM-dd}"></BoundCloumn>