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 September 21st, 2004, 10:15 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
Default while loop problem

It doesnot work, all of the things you told are in the code, but for some reason it complains. Any way i will come back to it later. I have a question again I am in the while loop and my output should be FirstName LastName.
                shoakat Kalloo
                Jason Andrew

  If there is nothing in the database by these names. It should out put. Records not in the database. My out put is be FirstName LastName.
                                         shoakat Kalloo
                                        FirstName LastName
                                         Jason Andrew
 Do While not objRst.EOF


  response.Write("<th>FirstName</th><th>LastName</th>")


Loop



 
Old September 21st, 2004, 03:44 PM
Authorized User
 
Join Date: Sep 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

this is happening because the header Firstname Lastname is in the loop. Either put the header outside the loop or keep a recordcounter. When the recordcount is at 1 print the header otherwise if >1 then print only the body
which is your names Jason Andrew etc. Also if its 0 u can print out no records in database heres an example:


dim reccount

do while not objrst.EOF

reccount = reccount + 1

if reccount = 1 then
            response.write your header
            response.write your body


elseif reccount = 0 then

            response.write("No records exist in the database")

else

    response.write your body only

end if








Similar Threads
Thread Thread Starter Forum Replies Last Post
Have a problem in For-each loop LeoMathew XSLT 2 July 16th, 2008 05:20 AM
loop problem smilesmita Pro PHP 1 November 2nd, 2007 02:15 AM
Loop problem! Please help me!! olud ASP.NET 1.0 and 1.1 Basics 2 March 19th, 2007 07:38 AM
problem of infinite loop sarah lee ASP.NET 1.0 and 1.1 Basics 19 December 14th, 2006 09:26 AM





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