Looping through Database??

G

Guest

Hi,

I'm new to ASP.NET and have just strated using VS 2003 what I want to know is how I do a loop through a table in a database? I would be grateful for any feedback!

I'm trying to build a menu programatically! I want to use a table to build a piece of code similar to this:

....: CODE :...
Dim submenu1 As New skmMenu.MenuItem("<img src=""images/menublip.gif"" align=""absmiddle"">Home", "")

submenu1.SubItems.Add(New skmMenu.MenuItem("Sub Item 1", "page1.html"))
submenu1.SubItems.Add(New skmMenu.MenuItem("Sub Item 2", "page2.html"))

Dim submenu3 As New skmMenu.MenuItem("Sub Item 3 ->", "")
submenu3.SubItems.Add(New skmMenu.MenuItem("Sub Item 3 - 1", "page1.html"))
submenu3.SubItems.Add(New skmMenu.MenuItem("Sub Item 3 - 2", "page2.html"))

submenu1.SubItems.Add(submenu3)
submenu1.SubItems.Add(New skmMenu.MenuItem("Sub Item 4", "page4.html"))
submenu1.SubItems.Add(New skmMenu.MenuItem("Sub Item 5", "page5.html"))
submenu1.SubItems.Add(New skmMenu.MenuItem("Sub Item 6", "page6.html"))
Menu1.Items.Add(submenu1)

Dim submenu2 As New skmMenu.MenuItem("<img src=""images/menublip.gif"" align=""absmiddle"">Office", "")

submenu2.SubItems.Add(New skmMenu.MenuItem("Sub Item 1", "page3.html", "tooltip1"))
submenu2.SubItems.Add(New skmMenu.MenuItem("Sub Item 2", "page4.html", "tooltip2"))
Menu1.Items.Add(submenu2)

.............................

In the table I would have the following fields

-menuid
-name
-url
-level

I would be really really grateful if someone could give me some advice on how to achive this!

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top