---
title: "Else?"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/143990-else"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "eko"
published: "2006-03-15T10:28:16.000Z"
updated: "2006-03-20T09:49:08.000Z"
replies: 5
views: 406
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/143990-else"
---

# Else?

## #1 — eko, 2006-03-15T10:28Z

I dagsläget med denna kod så visas ju ingenting om ingen info i databasen finns. Jag skulle istället vilja att det var så här: finns det ingen info i databasen så skall bilden notour.jpg visas istället! Förstår att det ska vara något med "else" men får inte till det... Någon som kan koden   :q 

```
<%
Session.LCID = 1033
Set Conn = Server.CreateObject("ADODB.Connection") 
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("data/mc.mdb")

Set objRS = Conn.Execute ("select top 1 city, datum, country, venue from tour WHERE datum>=date() order by datum")
If not objRS.EOF then
			response.write "<table border='0' cellpadding='0' cellspacing='0'><tr><td>&nbsp;</td></tr></table>"
            response.write "<table border='0' cellpadding='0' cellspacing='0'><tr><td><img src='graphic/next_show.gif'></td></tr></table>"
			response.write "<table border='0' cellpadding='0' cellspacing='0'><tr><td>&nbsp;</td></tr></table>"
			response.write "<table border='0' cellpadding='0' cellspacing='0'><tr><td width='55'>Country</td><td width='20'>&nbsp;</td><td width='150'>" & replace(objRS("country"),vbcrlf,"") & "</td></tr></table>"
			response.write "<table border='0' cellpadding='0' cellspacing='0'><tr><td width='55'>City</td><td width='20'>&nbsp;</td><td width='150'>" & objRS("city") & "</td></tr></table>"
			response.write "<table border='0' cellpadding='0' cellspacing='0'><tr><td width='55'>Venue</td><td width='20'>&nbsp;</td><td width='150'>" & replace(objRS("venue"),vbcrlf,"") & "</td></tr></table>"
			response.write "<table border='0' cellpadding='0' cellspacing='0'><tr><td width='55'>Date</td><td width='20'>&nbsp;</td><td width='150'>" & FormatDateTime(objRS("datum"),1) & "</td></tr></table>"
            response.write "<table border='0' cellpadding='0' cellspacing='0'><tr><td>&nbsp;</td></tr></table>"
			response.write "<table border='0' cellpadding='0' cellspacing='0'><tr><td>Constantly on the road! Check out the <a href='?p=2'>tour section</a> and find out when Melody Club is coming to blow up your town.</td></tr></table>"
            response.write "<table border='0' cellpadding='0' cellspacing='0'><tr><td>&nbsp;</td></tr></table>"
			response.write "<table border='0' cellpadding='0' cellspacing='0'><tr><td><img src='graphic/hr_225.gif'></td></tr></table>"
End if

objRS.Close
Set objRS = Nothing
Conn.Close
set Conn = Nothing
%>
```

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

## #2 — @nders, 2006-03-15T10:38Z

```
If not objRS.EOF then
	...
Else
	Response.write "<img src=""notour.jpg"">"
End if
```

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

## #3 — Danny, 2006-03-15T11:42Z

Precis. Det finns många bra trick man kan göra, kolla här:
<http://www.pellesoft.se/area/articles/article.aspx?artid=885>

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

## #4 — eko, 2006-03-20T09:43Z

> **@nders skrev:**
>
> ```
> If not objRS.EOF then
> 	...
> Else
> 	Response.write "<img src=""notour.jpg"">"
> End if
> ```

Tack @nders det verkar ju rätt!
Men vart i koden ska jag sätta in det?
Jag får bara felmess...   :o

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

## #5 — @nders, 2006-03-20T09:44Z

Du har ju redan if-satsen i koden. Lägg till en else...

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

## #6 — eko, 2006-03-20T09:49Z

> **@nders skrev:**
>
> Du har ju redan if-satsen i koden. Lägg till en else...

Tack!

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

---

Tråden på webben: https://www.webforum.nu/amne/asp/143990-else
