Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 1st, 2006, 05:45 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default displaying records using asp & sql

Hello

I'm hoping someone can solve my quandry. I need to display all records from a ms sql database on a page which is no problem. However, what I'm looking to do is display them so that the first one is right aligned, and the second records is left aligned and so on -

can anyone help me?

thanks

Adam

 
Old June 1st, 2006, 11:31 PM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

This can be done easily in while loop. You can keep a variable and check for even/odd and based on this display the contents. You also need to increment this variable in the loop.

Om Prakash
 
Old June 2nd, 2006, 07:36 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

Great, thanks Om

So if I have my code such as


.......
<%

rs.Recordset.movenext()


loop



end if

%>

what would be the coding for the variable and how would I increment the variable in the loop?

thanks

Adam

 
Old June 15th, 2006, 10:32 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The variable could be a boolean, and you just need to flip the boolean each loop

Code:
do while not rs.eof
   blnLeft = not blnLeft
   if blnLeft then
      ' Code to left justify
   else
      ' Code to right justify
   end if
   rs.movenext   
loop
Make sense?

Woody Z http://www.learntoprogramnow.com
 
Old June 28th, 2006, 08:41 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

Thanks guys but what I'm wanting to do is not pull out the same record every time - rather loop through the records pulling out a different, sequential image each time - at the moment it's pulling out the same record everytime.

Adam






Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in updating records & finding records naveed77 VB Databases Basics 1 January 16th, 2007 12:12 PM
problem in updating records & finding records naveed77 VB How-To 1 January 16th, 2007 12:10 PM
ASP & SQL Database ccolv Classic ASP Basics 2 July 22nd, 2003 03:27 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.