Pagina 1 di 3 1 2 3 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 29
  1. #1
    Utente di HTML.it L'avatar di M@sE
    Registrato dal
    Oct 2001
    Messaggi
    488

    Split dopo estrazione dal db e rimozione dei duplicati

    Ciao a tutti ragazzi ho credo un semplice problemino da risolvere... vado subito al dunque.

    questa è la qry:

    codice:
    <%
    i=1
    SQLCASE = "SELECT DISTINCT F2,F1 FROM [Sheet1$] WHERE F2<>''"
    Set DBCCASE = connessionExcel.Execute (SQLCASE)
    if not DBCCASE.EOF then
    do while not(DBCCASE.eof)
    I=I
    TITOLO_MAGAZZINO=DBCCASE("F2")
    TITOLO_MAGAZZINO=(Replace(TITOLO_MAGAZZINO," "," "))
    ALTRO=DBCCASE("F1")
    a=Split(TITOLO_MAGAZZINO)
    PRIMA=(a(0))
    
    response.write PRIMA &"
    "
    
    DBCCASE.movenext
    I=I+1
    loop
    else
    ERRORE="Nessun case disponibile."
    end if
    set connesionExcel = nothing
    set DBCCASE = nothing
    set SQLCASE = nothing
    %>
    Ottengo il seguente risultato (compresi duplicati)

    codice:
    ADATTATORE
    ADATTATORE
    ADATTATORE
    ADATTATORE
    ADATTATORE
    ADATTATORE
    ADATTATORE
    ADATTATORE
    ADATTATORE
    ADATTATORE
    ADATTATORE
    ADATTATORE
    ADATTATORE
    ADATTATORE
    ADATTATORE
    ALIMENTATORE
    ALIMENTATORE
    ALIMENTATORE
    ALIMENTATORE
    ALIMENTATORE
    ALIMENTATORE
    ALIMENTATORE
    ALIMENTATORE
    ALIMENTATORE
    ALIMENTATORE
    ALIMENTATORE
    ALIMENTATORE
    ALIMENTATORE
    ALIMENTATORE
    ALIMENTATORE
    La mia domanda è la seguente è possibile in visualizzazione eliminare i duplicati dello split ?

  2. #2
    non ti converrebbe usare il getrows per inserire i dati in un array, che puoi contollare più comodamente...

  3. #3
    Utente di HTML.it L'avatar di M@sE
    Registrato dal
    Oct 2001
    Messaggi
    488
    Ho tentato leggendo sul forum e con alcuni esempi, ma non sono riuscito in nessun modo.
    Saresti così gentile da darmi una mano, in base a ciò che ho fatto?

  4. #4
    codice:
    <%
    
    SQLCASE = "SELECT DISTINCT F2,F1 FROM [Sheet1$] WHERE F2<>''"
    Set DBCCASE = connessionExcel.Execute (SQLCASE)
    if not DBCCASE.EOF then
    
    array=dbccase.getrows
    colonne=ubound(array,1)
    righe=ubound(array,2)
    
    for i=0 to righe
    ii=i-1
    if i>0 and array(1,ii)<>array(1,i) then
    response.write(array(i))&"</br>"
    end if
    next
    
    else
    ERRORE="Nessun case disponibile."
    end if
    set connesionExcel = nothing
    set DBCCASE = nothing
    set SQLCASE = nothing
    %>
    in questo caso ipotizzo che il campo TITOLO_MAGAZZINO sia nella seconda posizione nel recordset...
    gli dico:se il valora precedente (ii) è diverso da quello attuale (i) allora stampamelo....tranne naturalemente il primo che è quello da cui si deve iniziare....
    magari ho scritto boiate....ma spero di no....

  5. #5
    Utente di HTML.it L'avatar di M@sE
    Registrato dal
    Oct 2001
    Messaggi
    488
    Grazie per il tuo aiuto, ho fatto così ma mi dava due problemi uno in array e l'ho modificato in arrays e l'altro nel ciclo if, ora mi da un 3 errore:

    codice:
    <%
    I=1
    SQLCASE = "SELECT DISTINCT F2,F1 FROM [Sheet1$] WHERE F2<>''"
    Set DBCCASE = connessionExcel.Execute (SQLCASE)
    if not DBCCASE.EOF then
    arrays=DBCCASE.getrows
    colonne=ubound(arrays,1)
    righe=ubound(arrays,2)
    for i=0 to righe
    ii=i-1
    if i>0 and arrays(1,ii)<>arrays(1,i) then
    response.write(arrays(i))&"</br>"
    end if
    next
    else
    response.write "Errore"
    end if
    set connesionExcel = nothing
    set DBCCASE = nothing
    set SQLCASE = nothing
    %>

    codice:
    Tipo di errore:
    Errore di run-time di Microsoft VBScript (0x800A0009)
    Indice non incluso nell'intervallo: '-1'
    /dbe/configuratore.asp, line 20
    a cosa si riferisce?

  6. #6
    per il primo errore ho usato stupidamente una parola riservata....
    prova così.....
    sinceramente come te l'ho scritto è un po macchinoso...in verità esistono alcuni script proprio per gestire gli array, tipo eliminare i duplicati,ordinarli etc etc.....

    codice:
    <%
    SQLCASE = "SELECT DISTINCT F2,F1 FROM [Sheet1$] WHERE F2<>''"
    Set DBCCASE = connessionExcel.Execute (SQLCASE)
    if not DBCCASE.EOF then
    arrays=DBCCASE.getrows
    colonne=ubound(arrays,1)
    righe=ubound(arrays,2)
    for i=0 to righe
    if i>0 then
    ii=i-1
    if arrays(1,ii)<>arrays(1,i) then
    response.write(arrays(i))&"</br>"
    end if
    end if
    next
    else
    response.write "Errore"
    end if
    set connesionExcel = nothing
    set DBCCASE = nothing
    set SQLCASE = nothing
    %>

  7. #7
    Utente di HTML.it L'avatar di M@sE
    Registrato dal
    Oct 2001
    Messaggi
    488
    mi processa un'altro errore:

    codice:
    <%
    I=1
    SQLCASE = "SELECT DISTINCT F2,F1 FROM [Sheet1$] WHERE F2<>''"
    Set DBCCASE = connessionExcel.Execute (SQLCASE)
    if not DBCCASE.EOF then
    arrays=DBCCASE.getrows
    colonne=ubound(arrays,1)
    righe=ubound(arrays,2)
    for i=0 to righe
    if i>0 then
    ii=i-1
    if arrays(1,ii)<>arrays(1,i) then
    response.write(arrays(i))&"</br>"
    end if
    end if
    next
    else
    response.write "Errore"
    end if
    set connesionExcel = nothing
    set DBCCASE = nothing
    set SQLCASE = nothing
    %>
    codice:
     Errore di run-time di Microsoft VBScript (0x800A0009)
    Indice non incluso nell'intervallo: 'arrays'
    /dbe/configuratore.asp, line 21

  8. #8
    asp che guardo...

  9. #9
    Utente di HTML.it L'avatar di M@sE
    Registrato dal
    Oct 2001
    Messaggi
    488
    Qua sono..

  10. #10
    ora mi trovo senza un pc su cui testare...appena posso ti dico...

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.