Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it L'avatar di [trodat]
    Registrato dal
    Oct 2004
    Messaggi
    2,135

    Subscript out of range: 'indx'

    Ciao; perchè qeusto script restituisce:

    Error Type:
    Microsoft VBScript runtime (0x800A0009)
    Subscript out of range: 'indx'
    /den/Info_Drv_sch.asp, line 111

    Line 111 :
    js(indx) = tmp + js(indx-1)

    codice:
    Set oRs0 = oConn.Execute("SELECT DISTINCT tot_day_hrs AS Tot FROM schedule WHERE [Driver_ID]= "&rs9("Driver_ID")&" and shift_interval=1 and tot_day_hrs <> 0 ")
    					Set oRs1 = oConn.Execute("SELECT DISTINCT tot_day_hrs AS Tot1 FROM schedule WHERE [Driver_ID]= "&rs9("Driver_ID")&" and shift_interval=2 and tot_day_hrs <> 0 ") 
    				
    						 while not oRs0.EOF
    							tmp=""
    							tmp1=""
    							
    								if  len(trim(oRs0("Tot"))) > 2 Then 
    											ji= split(trim(oRs0("Tot")),".")(1)
    		
    										  if left(ji,1) <> "0" and len(ji) = 1 Then 
    												ji = ji & "0"
    												tmp = ji
    												js(indx) = tmp + js(indx-1)
    												
    										  else
    												ji = ji
    												tmp = ji
    												js(indx) = tmp + js(indx-1)
    												'response.Write(js(indx)  & " " & tmp )
    										  End if 
    										  
    										  ji1= split(oRs0("Tot"),".")(0)
    										  tmp1 = ji1
    										  js1(indx) = tmp1 + js1(indx-1)
    										  indx = indx + 1
    										
    								elseif (len(trim(oRs0("Tot"))) < 2 and trim(oRs0("Tot")) <> 0 )  Then
    										  'Mins
    										  tmp = trim(oRs0("Tot"))
    										  js(indx) = 0
    										 'Hour
    										  js1(indx) = tmp + js1(indx-1)
    										  indx = indx + 1
    								else
    										js(indx) = 0
    										js1(indx) = 0
    										indx = indx + 1
    								End if 
    							
    							
    							
    						oRs0.MoveNext
    					wend
    Lo Stato dà un posto. L’impresa privata dà un lavoro. – Indro Montanelli

  2. #2
    E' probabile che cerchi di usare un indice massimo di array che va oltre all'indice massimo reale.
    E' come se ad esempio tu scrivi:
    codice:
    dim mioArray(3)
    
    ' e poi fai
    mioArray(4) = "pippo"
    Noti il problema?

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.