---
title: "Exception occured i loop! Varför?"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/92126-exception-occured-i-loop-varför"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "Johanneshov"
published: "2003-12-08T13:37:23.000Z"
updated: "2003-12-08T21:18:48.000Z"
replies: 3
views: 225
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/92126-exception-occured-i-loop-varför"
---

# Exception occured i loop! Varför?

## #1 — Johanneshov, 2003-12-08T13:37Z

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
		    	%>
```

Permalänk: https://www.webforum.nu/p/92126

## #2 — LR^evil.sid, 2003-12-08T14:31Z

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

Permalänk: https://www.webforum.nu/p/1222357

## #3 — LarsG, 2003-12-08T16:19Z

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
```

Permalänk: https://www.webforum.nu/p/1222457

## #4 — Johanneshov, 2003-12-08T21:18Z

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!

Permalänk: https://www.webforum.nu/p/1222653

---

Tråden på webben: https://www.webforum.nu/amne/asp/92126-exception-occured-i-loop-varför
