Ver Mensaje Individual
  #7 (permalink)  
Antiguo 08/06/2007, 16:52
Avatar de CésarBalaguer
CésarBalaguer
 
Fecha de Ingreso: octubre-2006
Ubicación: en mi casa
Mensajes: 181
Antigüedad: 18 años, 7 meses
Puntos: 0
Re: Dimensionar arrgeglos dinamicamente

Cita:
RS.Open sql, cxn
if Err=0 then
tantos=0
while RS.EOF=false
tantos=tantos+1
RS.movenext
wend
end if
RS.close
en lugar de hacer 2 querys uno para dimensionar el arreglo y otra para llenar los el arreglo con los datos de la tabla, mas recomendable serìa hacer los dos en un solo query, asì te evitas tantas lecturas similares a la base de datos y por ende se hace mas ràpido.

sql = "select COLUMNA from TABLA where CONDICION"
RS.Open sql, cxn
if not RS.EOF then
tantos=0
while RS.EOF=false
REDIM PRESERVE ARREGLO(tantos)
ARREGLO(tantos) = RS(0)
tantos = tantos + 1
RS.movenext
wend
end if
RS.close