I had been trying to figure out a way to sort the pictures that I have in a database randomly. I knew that you could choose to order them according to a specific id in ascending or descending order. But, I did not know that you could simply use the code "Order By NEWID()" in the select statement to accomplish this. As a result, I ended up with the following:
itemtemplate
asp:label runat="server" id="lblPics" text='<%# Eval("Pictures") %>'>
asp:label
itemtemplate
...and then use the sql select command,
SELECT [Pictures] FROM [My_Photos] Order By NEWID()
...pretty cool.
Tuesday, July 31, 2007
Subscribe to:
Post Comments (Atom)
3 comments:
hey good tip. I always used a temporary table for this....kel
Yeah...I thought it would be much more difficult to implement this...but it was pretty simple.
How's Sean doing?
Post a Comment