Ver Mensaje Individual
  #8 (permalink)  
Antiguo 16/03/2009, 14:53
Avatar de Tony Manero
Tony Manero
 
Fecha de Ingreso: diciembre-2002
Ubicación: en la disco
Mensajes: 34
Antigüedad: 23 años, 10 meses
Puntos: 0
Respuesta: ordenar datos de archivo de texto

funciono perfecto
al final lo deje asi, por si a alguien le sirve
Código PHP:
<&#37;
Sub top_ten
CONST adFldIsNullable = &H00000020
CONST adVarChar = 200
CONST adInteger = 3
CONST adDate = 7
CONST adOpenDynamic = 2
CONST adUseClient = 3

Set FSO 
= Server.CreateObject("Scripting.FileSystemObject")
Set wfile = fso.OpenTextFile("c:\data\scores\local_scores.txt") 

Set rs = Server.CreateObject("ADODB.Recordset")

With rs
    
.CursorLocation = adUseClient
    
.CursorType = adOpenDynamic
    
.Fields.Append "login", adVarChar, 255, adFldIsNullable
    
.Fields.Append "wins", adVarChar, 255, adFldIsNullable
    
.Fields.Append "score", adInteger, 255, adFldIsNullable
    
.open

    wfile
.readline
    wfile
.readline
    
Do While Not wfile.AtEndOfLine
        arregloTMP
=Split(wfile.ReadLine,"#")
        .
AddNew
        
.Fields("login") = arreglotmp(0)
        .
Fields("wins") = arreglotmp(1)
        .
Fields("score") = arreglotmp(2)
        .
update
    Loop
    
    Orden 
= Request.QueryString("Orden")
    
Select CASE Orden
        
Case "" OrdenarPor = "score DESC"
        
Case "wins" OrdenarPor = "wins ASC"
        
Case "login" OrdenarPor = "login DESC"
        
Case Else OrdenarPor = "score ASC"
    
End Select

        
.Sort = OrdenarPor
        
.MoveFirst

        response
.write "<table>"
        
response.write "<tr><td>login</td><td>wins</td><td>score</td></tr>"
        
i=0
        
do while not .eof
 ac
&#225; recorrés el recordset volátil y creás el html necesario....
            
response.write "<tr>"
            
response.write "<td>"&rs.fields(0)&"</td>"
            
response.write "<td>"&rs.fields(1)&"</td>"
            
response.write "<td>"&rs.fields(2)&"</td>"
            
response.write "</tr>"
            
If i=10 Then
                
Exit do
            
End if
            
i=i+1
            
.Movenext
        Loop
        response
.write "</table>"
        
.close
End With
Set rs 
= nothing
Set folder 
= nothing 
Set fso 
= nothing
End sub
%>