Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 WHILE Loop

Author  Topic 

oahu9872
Posting Yak Master

112 Posts

Posted - 2006-01-31 : 16:02:05
I am trying to build a thumbnail gallery of images stored in a database.

I'd like them to come out of the database and into a table with 5 columns and after the fifth column start a new row. I'm not sure how to get it to move to the next row after 5 columns.

any help would be appreciated. thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-01-31 : 16:03:44
Could you provide a data example?

Tara Kizer
aka tduggan
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2006-01-31 : 16:06:03
I'd like to help...can you provide some sample images....

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam
Go to Top of Page

oahu9872
Posting Yak Master

112 Posts

Posted - 2006-01-31 : 16:14:52
I have a field of pictures named MSA1.jpg, MSA2.jpg, MSA3.jpg, .... MSA400.jpg. I'd like it to go into a table so it does the following...

Row 1
Column 1 - MSA1.jpg
Column 2 - MSA2.jpg
Column 3 - MSA3.jpg
Column 4 - MSA4.jpg
Column 5 - MSA5.jpg

then go to row 2, etc. all the way through the 400 pictures.

is that possible to do that? i hope that helps
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-01-31 : 16:18:41
Why would you want to do this? Each image should be in its own row.

Tara Kizer
aka tduggan
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2006-01-31 : 16:20:49
This is not a database question, but a question for ASP or HTML or whatever you are using to present this data.

What tool are you using to query the database and to create the webpage? (i..e, ASP.NET)
Go to Top of Page

oahu9872
Posting Yak Master

112 Posts

Posted - 2006-01-31 : 16:25:37
The reason I'm doing this is I'm trying to build a thumbnail gallery and the images will come from a database. I need 5 column rows. Anyway, I finally got it to work. This is how I did it if anyone is interested. Thanks for the help.

<%
Dim column
Const COLUMN_COUNT = 3 '

column = 0 '

Do While Not rsPics.EOF

If column = 0 Then Response.Write "<TR>"
Response.Write "<TD>" & _
RsPics("FileName") & "</TD>"

column = column + 1
If column = COLUMN_COUNT Then
Response.Write "</TR>" & vbNewLine
column = 0 ' start over!
End If
RsPics.MoveNext
Loop

If column <> 0 Then
For c = column To COLUMN_COUNT
Response.Write "<TD>???</TD>"
Next
Response.Write "</TR>" & vbNewLine
End If

%>
Go to Top of Page
   

- Advertisement -