---
title: "Lägga till data från databas i dropdownmeny"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/76952-lägga-till-data-från-databas-i-dropdownmeny"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "Runken"
published: "2003-05-14T21:56:18.000Z"
updated: "2003-05-21T14:38:43.000Z"
replies: 3
views: 255
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/76952-lägga-till-data-från-databas-i-dropdownmeny"
---

# Lägga till data från databas i dropdownmeny

## #1 — Runken, 2003-05-14T21:56Z

Hej!

Hur skriver man en loop-sats för att placera data från en databas i en dropdown-meny? Använder ASP och en MySQL-databas.

strSQL = SELECT storlek FROM produkter WHERE produktnamn = namn

\<tr\> 
                          \<td\>\<select name="strl1"\>
                              \<option\>\</option\>
                            \</select\>\</td\>
\</tr\>

...

Out bicycling..

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

## #2 — Palle, 2003-05-14T22:43Z

Finns olika sätt att lösa det på.. här är ett: :)

```
[red]<tr> 
<td>

<%

Set RecSet = Connect.Execute("SELECT storlek FROM produkter WHERE produktnamn = 'namn '")
	If NOT RecSet.EOF Then arrRecSet = RecSet.GetRows()
RecSet.Close : Set RecSet = Nothing

   If IsArray(arrRecSet) Then

	Response.Write "<select name=""strl1""> "

	For i = 0 To UBound(arrRecSet, 2)
		strStorlek = arrRecSet(0,i)
		Response.Write "<option value="""& strStorlek &""">"& strStorlek &"</option>"
	Next

	Response.Write "</select>"
	
   Else
	Response.Write "Fanns inget att hämta.."

   End If

%>

</td> 
</tr> [/red]
```

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

## #3 — crisse6, 2003-05-15T00:49Z

nothing.....  :r

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

## #4 — Runken, 2003-05-21T14:38Z

Tackar! 
Det hjälpte oss:)

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

---

Tråden på webben: https://www.webforum.nu/amne/asp/76952-lägga-till-data-från-databas-i-dropdownmeny
