Visualizzazione dei risultati da 1 a 9 su 9
  1. #1
    Utente di HTML.it L'avatar di Trinità76
    Registrato dal
    Jan 2002
    Messaggi
    1,439

    Asp Db error '80020009'

    error '80020009'
    Exception occurred.
    /mydatabase.asp, line 1164
    Lo script che interroga il database sulla data e qualora questa sia nulla non la visualizza, funziona.

    codice:
                                    <%            
    		Response.Write RS.Fields ("Da") & " [i]"
    		If RS.Fields ("Data")="" OR IsNull(RS.Fields ("Data")) Then
    			Response.Write ("")
    		Else
    			Response.Write (" - " & "" & RS.Fields ("Data") & "")
    			
    		End If
    		RS.MoveNext
    		%>
    Il problema è che ho 43 record suddivisi in pagine che ne contengono 5 alla volta. Quando il db arriva al 43° mi da quel messaggio dei errore...
    Ho eliminato manualmente le ultime due righe di Asp (che richiamerebbero il 44° e il 45° (che non esistono), e ho commentato nel 43° record il RS.MoveNext, ma l'errore c'è sempre...

    Forse andrebbe incorporato tutto il codice in una funzione e il movenext andrebbe dato verificando se si è arrivati alla fine del db...
    わさび

  2. #2
    Utente di HTML.it L'avatar di Corwin
    Registrato dal
    Jan 2002
    Messaggi
    584
    codice:
    Response.Write RS.Fields ("Da") & " [i]"
                    If not Rs.Eof Then
    		If RS.Fields ("Data")="" OR IsNull(RS.Fields ("Data")) Then
    			Response.Write ("")
    		Else
    			Response.Write (" - " & "" & RS.Fields ("Data") & "")
    			
    		End If
    
    		RS.MoveNext
                    End If
    		%>
    I don't wanna have to shout it out / I don't want my hair to fall out
    I don't wanna be filled with doubt / I don't wanna be a good boy scout
    I don't wanna have to learn to count / I don't wanna have the biggest amount
    I don't wanna grow up

  3. #3
    Utente di HTML.it L'avatar di Trinità76
    Registrato dal
    Jan 2002
    Messaggi
    1,439
    Niente da fare
    ho provato anche con
    codice:
    If objRecordset.EOF Then
    Response.Write "empty"
    Response.End
    End If
    ma mi da lo stesso errore...
    わさび

  4. #4
    Utente di HTML.it L'avatar di Corwin
    Registrato dal
    Jan 2002
    Messaggi
    584
    If not Rs.Eof Then

    Response.Write RS.Fields ("Da") & " [i]"
    If RS.Fields ("Data")="" OR IsNull(RS.Fields ("Data")) Then
    Response.Write ("")
    Else
    Response.Write (" - " & "" & RS.Fields ("Data") & "")

    End If

    RS.MoveNext
    End If
    %>
    I don't wanna have to shout it out / I don't want my hair to fall out
    I don't wanna be filled with doubt / I don't wanna be a good boy scout
    I don't wanna have to learn to count / I don't wanna have the biggest amount
    I don't wanna grow up

  5. #5
    Utente di HTML.it L'avatar di Trinità76
    Registrato dal
    Jan 2002
    Messaggi
    1,439
    Che carciofo non avevo notato che l'If not Rs.Eof va messo per primo altrimenti è tutto inutile... un'ultima cosa, prima ho provato ad incorporare tutto questo codice in una funzione in modo tale da richiamarla rigo per rigo, ma devo aver fatto qualche errore di sintassi... saresti così gentile da dirmi come impostarle?
    わさび

  6. #6
    Utente di HTML.it L'avatar di Corwin
    Registrato dal
    Jan 2002
    Messaggi
    584
    uh, prova a postare quello che hai fatto..
    I don't wanna have to shout it out / I don't want my hair to fall out
    I don't wanna be filled with doubt / I don't wanna be a good boy scout
    I don't wanna have to learn to count / I don't wanna have the biggest amount
    I don't wanna grow up

  7. #7
    Utente di HTML.it L'avatar di Trinità76
    Registrato dal
    Jan 2002
    Messaggi
    1,439
    Originariamente inviato da Corwin
    uh, prova a postare quello che hai fatto..
    Per come l'ho impostata io mi da Syntax error...
    In realtà non ho fatto altro che aggiungere Function nome()
    e poi End Function alla fine... Credevo fosse sufficiente... in effetti poi all'interno della funzione ci sono i Response.Write che dicono di stampare al video il risultato dei vari If e credevo funzionasse...

    Comunque è così:
    codice:
    	Function Elenco ()
    	
    				If not Rs.Eof Then
    				Response.Write RS.Fields ("Da") & " [i]"
    				If RS.Fields ("Data")="" OR IsNull(RS.Fields ("Data")) Then
    					Response.Write ("")
    					Else
    					Response.Write (" - " & "" & RS.Fields ("Data") & "")
    						If RS.Fields ("Data_add")="" OR IsNull(RS.Fields ("Data_add")) Then
    							Response.Write ("")
    						Else
    							Response.Write (" " & RS.Fields ("Data_add") & "")
    						End If
    					End If
    				RS.MoveNext
    				End If
    	
    	End Function
    Come dicevo questo è lo script che in realtà scrivevo all'interno di ogni riga creata con delle tabelle...
    Non mi è possibile loopare le azioni con dei cicli perchè altrimenti la veste grafica sarebbe compromessa...
    わさび

  8. #8
    Utente di HTML.it L'avatar di Trinità76
    Registrato dal
    Jan 2002
    Messaggi
    1,439
    Ho letto la guida su manastungare.com sulla scrittura delle Funzioni e delle Sottoroutine, ma non capisco cosa ci sia di sbagliato nella mia sintassi... La guida dice:
    Le sottoroutine non possono ritornare un valore, possono solo essere richiamate, e il loro valore non può essere usato. Per ritornare dei valori si usano le Funzioni...
    Nel mio caso sarebbe meglio utilizzare una sottoroutine?
    わさび

  9. #9
    Utente di HTML.it L'avatar di Trinità76
    Registrato dal
    Jan 2002
    Messaggi
    1,439
    up
    わさび

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.