Ciao a tutti,
devo ordinare dati estratti da DB in base ad un array.
Vi spiego meglio:
ho 2 array:
tramite l'array riferimentoinvernale faccio la select nel DB, così:codice:dim riferimentoinvernale(1000) dim prezzoinvernale(1000)
Ora, vorrei ordinare la select in base all'array prezzoinvernale.codice:set rs = server.createObject("ADODB.Recordset") strq="select * from strutture where ((attiva = 'S') and (stato = 'A') and (durataminimasoggiorno <= " & ricercanotti & ") and (tipovacanza=" & chr(34) & ricercatipovacanza & chr(34) & ") and (tipostruttura=" & chr(34) & ricercatipostruttura & chr(34) & ") and (postiletto>=" & Cint(ricercaletti) & ") and (mappaprovincia like " & chr(34) & ricercaprovince & chr(34) & ") and (mappacomune like" & chr(34) & ricercacomuni & chr(34) & ") and (mappalocalita like " & chr(34) & ricercalocalita & chr(34) & ")" 'strq="select * from strutture where ((attiva = 'S') and (stato = 'A')" set rs2 = server.createObject("ADODB.Recordset") strq2 = "select count(*) as totrec from strutture where ((attiva = 'S') and (stato = 'A') and (durataminimasoggiorno <= " & ricercanotti & ") and (tipovacanza=" & chr(34) & ricercatipovacanza & chr(34) & ") and (tipostruttura=" & chr(34) & ricercatipostruttura & chr(34) & ") and (postiletto>=" & Cint(ricercaletti) & ") and (mappaprovincia like " & chr(34) & ricercaprovince & chr(34) & ") and (mappacomune like" & chr(34) & ricercacomuni & chr(34) & ") and (mappalocalita like" & chr(34) & ricercalocalita & chr(34) & ")" 'strq2 = "select count(*) as totrec from strutture where ((attiva = 'S') and (stato = 'A')" if x > 0 then strq = strq & " and (" strq2 = strq2 & " and (" for k = 0 to x-1 strq = strq & "(riferimento = '" & riferimentoinvernale(k) & "')" strq2 = strq2 & "(riferimento = '" & riferimentoinvernale(k) & "')" if x-1 > k then strq = strq & " or " strq2 = strq2 & " or " end if next strq = strq & ")" strq2 = strq2 & ")" end if strq = strq & ") order by id LIMIT "& inizio &", "& pageSize strq2 = strq2 & ")"
Credo sia una cosa complicata... non mi è venuta nessuna soluzione funzionante in mente.
Come potrei fare?
Fatemi sapere.
Grazie mille.

Rispondi quotando