Pagina 1 di 3 1 2 3 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 21
  1. #1

    Invertire l'ordine alfabetico

    Salve,
    come di modifica il seguente codice per invertire l'ordine alfabetico?

    <%
    set custRs = Server.CreateObject("ADODB.Recordset")
    custRs.Fields.Append "nome", 200, 300 ' adVarChar
    custRs.Fields.Append "dimensione", 2, 4 ' smallint
    custRs.Fields.Append "data", 7 ' Date
    custRs.Open

    ' popolamento
    Set FileObject = Server.CreateObject("Scripting.FileSystemObject")

    Set f = FileObject.GetFolder(strPath)

    For Each f1 in f.Files
    custRs.AddNew
    custRs("nome") = f1.name
    custRs("data") = f1.DateCreated
    Next

    Set f = Nothing
    Set FileObject = Nothing

    custRs.Sort = "data DESC"

    If Not custRS.EOF AND Not custRS.BOF Then
    nomefile = custRs("nome")

    Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
    Set f = FileObject.getfile(StrPath&"\"&nomefile)
    he = ImageHeight(StrPathShort & nomefile)
    wi = ImageWidth(StrPathShort & nomefile)
    resized = ImageResize(StrPathShort & nomefile, 80, 80, "center")
    Set f = Nothing
    Set FileObject = Nothing
    Else
    %>

    grazie

  2. #2
    custRs.Sort = "data DESC, nome DESC"

  3. #3

  4. #4
    non so come funzioni il tuo codice ma credo bisogni cambiare l'ordinamento qui
    invece che
    custRs.Sort = "data DESC"

    così
    custRs.Sort = "nome DESC"

    così li ordina per nome decrescente

  5. #5
    andrebbe bene anche...(anzi per me sarebbe meglio) un ordine per data al posto per nome, che faccia vedere per prima le date piu recenti.

  6. #6
    continua a non cambiare nulla....

    il codice che segue è:

    <%
    End If
    %>

    <%
    Dim objFSO, objFolder, objFile

    Set objFSO = server.createobject("scripting.filesystemobject")
    Set objFolder = objFSO.getfolder(strpath)

    fileMAX = 4
    intTotalFiles = objFolder.Files.Count
    If objFolder.Files.Count MOD fileMAX = 0 Then
    intTotalPages = Int(objFolder.Files.Count/fileMAX)
    Else
    intTotalPages = Int(objFolder.Files.Count/fileMAX)+1
    End If
    %>



    e poi...

    <%
    If intTotalFiles > 0 Then
    col = 0
    imagecounter = 1

    If Request.QueryString("page").Count > 0 Then
    intPageNum = CInt(Request.QueryString("page"))
    Else
    intPageNum = 1
    End If


    For Each objFile in objFolder.Files

    'Response.Write imagecounter & "-" & (intPageNum*4)-3 & "-" & (intPageNum*4) &"
    "

    If (imagecounter >= (intPageNum*fileMAX)-(fileMAX-1)) And (imagecounter <= (intPageNum*fileMAX)) Then
    col = col + 1
    If col = 1 Then Response.Write "<tr>" & vbcrlf
    he = ImageHeight(StrPathShort & objfile.name)
    wi = ImageWidth(StrPathShort & objfile.name)
    resized = ImageResize(StrPathShort & objfile.name, 200, 200, "center")
    Response.Write "<td align=""center"" width=""135"">" & vbcrlf & "<table width=""100%""><tr><td align=""center"" height=""110""><table cellspacing=""0"" cellpadding=""0"" style=""border: 1 solid #6699CC""><tr><td>" & resized & "</td></tr></table></td></tr><tr><td align=""center"">" & objfile.name & "
    " & wi & "x" & he & "
    " & objfile.size & "byte
    " & objFile.DateCreated & "</td></tr></table>
    " & vbcrlf & "</td>" & vbcrlf
    If col = 4 Then
    Response.Write "</tr>" & vbcrlf
    col = 0
    End If
    'If col > 4 Then col = 1
    End If

    imagecounter = imagecounter + 1
    'If imagecounter > fileMAX Then Exit For
    Next

    If col > 0 AND col < 4 Then
    For colonne = col+1 To 4
    Response.Write "<td width=""135""></td>" & vbcrlf
    Next
    Response.Write "</tr>" & vbcrlf
    End If

    Else
    %>
    <tr><td align="center"></td></tr>
    <tr><td align="center">Non ci sono immagini</td></tr>
    <tr><td align="center"></td></tr>
    <%
    End If
    %>


    cosa puo essere responsabile dell'ordinamento?

  7. #7
    in teoria già te lo ordina per data decrescente :master:

    edit: parlo del primo script che hai postato

  8. #8
    e come di dovrebbe fare per ordinare in modo opposto?
    ...facendo solo la modifica indicata prima....non cambia nulla....

  9. #9
    ho provato anche a cancellare la seuente parte iniziale del codice.....

    <%
    set custRs = Server.CreateObject("ADODB.Recordset")
    custRs.Fields.Append "nome", 200, 300 ' adVarChar
    custRs.Fields.Append "dimensione", 2, 4 ' smallint
    custRs.Fields.Append "data", 7 ' Date
    custRs.Open

    ' popolamento
    Set FileObject = Server.CreateObject("Scripting.FileSystemObject")

    Set f = FileObject.GetFolder(strPath)

    For Each f1 in f.Files
    custRs.AddNew
    custRs("nome") = f1.name
    custRs("data") = f1.DateCreated
    Next

    Set f = Nothing
    Set FileObject = Nothing

    custRs.Sort = "data DESC"

    If Not custRS.EOF AND Not custRS.BOF Then
    nomefile = custRs("nome")

    Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
    Set f = FileObject.getfile(StrPath&"\"&nomefile)
    he = ImageHeight(StrPathShort & nomefile)
    wi = ImageWidth(StrPathShort & nomefile)
    resized = ImageResize(StrPathShort & nomefile, 80, 80, "center")
    Set f = Nothing
    Set FileObject = Nothing
    Else
    %>

    <%
    End If
    %>

    e il file funziona sempre e con lo stesso ordinamento...quindi non dipende da esso.
    Da cosa puo dipendere allora l'ordinamento decrescente per nome?
    e come si fa ad invertirlo oppure a far ordinare per data?

  10. #10
    finché lascerai questa istruzione

    custRs.Sort = "data DESC"


    il recordset verrà sortato per data discendente. se non lo cambi come ti è stato detto resterà per sempre nei secoli dei secoli così.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.