Print Page | Close Window

Database Display

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=3836
Printed Date: 28 March 2026 at 4:29pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Database Display
Posted By: ziwez0
Subject: Database Display
Date Posted: 25 June 2003 at 5:17pm

I know in ASP you could use the Loop method to go through records, but in asp.net how do you do it?

the following code ive done displays a image 1 after the other but how do i get it to display 5 images in a row(and 5 after that etc)..

<%@ Import Namespace="System.Data.OleDb" %><script runat="server">
sub Page_Load
dim dbconn,sql,dbcomm,dbread
dbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; data source=" & server.mappath("/database/photolib.mdb"))

dbconn.Open()
sql="SELECT smallimage FROM photo"
dbcomm=New OleDbCommand(sql,dbconn)
dbread=dbcomm.ExecuteReader()
photo.DataSource=dbread
photo.DataBind()
dbread.Close()
dbconn.Close()
end sub
</script>

<form runat="server">
<asp:Repeater id="photo" runat="server"><HeaderTemplate>
<table border="1" width="100%">
<tr>
<th>Small Image</th>
</tr>
</HeaderTemplate><ItemTemplate>
<tr>
<td><img src="<%#Container.DataItem("smallimage")%>"></td>

</tr>
</ItemTemplate><FooterTemplate>
</table>
</FooterTemplate></asp:Repeater>
</form>



-------------
If anything takes long to do its worth doing.



Replies:
Posted By: FatOtis
Date Posted: 28 June 2003 at 1:49pm

Hey dude I'm having the same sorta problem, I wanna use it to display only a set number of database records though (for a blog)

Tried looking over at w3schools.com/aspnet? *shrugs*




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net