webForumDet fria alternativet

Exception occured i loop! Varför?

3 svar · 223 visningar · startad av Johanneshov

JohanneshovMedlem sedan nov. 200387 inlägg
#1

Vad kan vara fel? Jag får "Exeption occured"... vad betyder det?
Följande skall loopa om datumet är, samt så länge datumet är... det rätta!

  		  	
Do while CInt(Right(RS("Datum"),2)) = CInt(iCounter)	  	                Response.Write("Pass:" &VbCrLf & dagpass)
        		Response.Write VbCrLf
        		Response.Write Rs("Pass")
	        	Response.Write VbCrLf
    	    	Response.Write Int(rs("tid")/60) & ":" & Right("0" &  (rs("tid") MOD 60), 2) &VbCrLf & "h."
        		Response.Write VbCrLf 
        		Response.Write Rs("Str") &VbCrLf & "km." & VbCrLf
        		Response.Write "<br>"
        		Response.Write Rs("Kommentar")
        		dagpass = dagpass + 1
		RS.MoveNext
Loop
		    	%>
LR^evil.sidMedlem sedan maj 2002560 inlägg
#2

Se till så du inte får med div. bindesträck och slashar.

CInt(Day(CDate(RS("Datum"))))

om datumet i databasen är av giltigt datumformat.

MVH

LarsGMedlem sedan dec. 200012 464 inlägg
#3

Du måste alltid testa för eof i första hand

Do while not rs.eof
if CInt(Day(CDate(RS("Datum")))) <> CInt(iCounter) then exit do
JohanneshovMedlem sedan nov. 200387 inlägg
#4

Så där ja!

Do while not Rs.EOF
If CInt(Right(RS("Datum"),2)) <> CInt(iCounter) Then Exit Do	
              If CInt(Right(RS("Datum"),2)) = CInt(iCounter) Then
	                Response.Write("Pass:" &VbCrLf & dagpass)
        		Response.Write VbCrLf
        		Response.Write Rs("Pass")
	        	Response.Write VbCrLf
    	    	Response.Write Int(rs("tid")/60) & ":" & Right("0" &  (rs("tid") MOD 60), 2) &VbCrLf & "h."
        		Response.Write VbCrLf 
        		Response.Write Rs("Str") &VbCrLf & "km." & VbCrLf
        		Response.Write "<br>"
        		Response.Write Rs("Kommentar")
        		dagpass = dagpass + 1
		RS.MoveNext
	End If
Loop

Tack!

126 ms totalt · 3 externa anrop · v20260731065814-full.30151723
0 ms — hämta forumlista (cache)
0 ms — hämta statistik (cache)
123 ms — hämta tråd, inlägg och bilagor (db)