Current location: Hot Scripts Forums » Programming Languages » ASP » How to do SQL query in a ASP while loop


How to do SQL query in a ASP while loop

Reply
  #1 (permalink)  
Old 09-07-04, 05:04 AM
superman2004 superman2004 is offline
Newbie Coder
 
Join Date: Aug 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
How to do SQL query in a ASP while loop

Y i cant do SQL Query in ASP while loop, do until, do while loop ?

Code:
    DO WHILE NOT rs6.eof
   sql5 = "SELECT * FROM CK_MO_Testing WHERE Read_Flag = '0' AND Message like 'CK "&rs6("Name")&"%'"
   rs5.open sql5, conn1
   IF rs5.eof AND rs5.bof THEN
	response.write "Nothing"
   ELSE
	response.write rs5("Message")
   END IF
  LOOP
Please help me
Reply With Quote
  #2 (permalink)  
Old 09-08-04, 09:28 AM
chirag's Avatar
chirag chirag is offline
Newbie Coder
 
Join Date: May 2004
Posts: 93
Thanks: 0
Thanked 0 Times in 0 Posts
Wink

Hi,

Certainly you can.
Try following code.....

==================================
DO WHILE NOT rs6.eof
sql5 = "SELECT * FROM CK_MO_Testing WHERE Read_Flag = '0' AND Message like 'CK "&rs6("Name")&"%'"

if rs5.state = adstateopen then
rs5.close
end if

rs5.open sql5, conn1
IF rs5.eof AND rs5.bof THEN
response.write "Nothing"
ELSE
response.write rs5("Message")
END IF
LOOP
========================
enjoy!!!
Reply With Quote
  #3 (permalink)  
Old 09-09-04, 03:35 AM
superman2004 superman2004 is offline
Newbie Coder
 
Join Date: Aug 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by chirag
Hi,

Certainly you can.
Try following code.....

==================================
DO WHILE NOT rs6.eof
sql5 = "SELECT * FROM CK_MO_Testing WHERE Read_Flag = '0' AND Message like 'CK "&rs6("Name")&"%'"

if rs5.state = adstateopen then
rs5.close
end if

rs5.open sql5, conn1
IF rs5.eof AND rs5.bof THEN
response.write "Nothing"
ELSE
response.write rs5("Message")
END IF
LOOP
========================
enjoy!!!
THANKS it is work oredi
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL infinite loop problem with VB application Syed Visual Basic 2 05-07-04 10:19 AM
searching using LIKE in SQL query coolblu PHP 6 12-29-03 11:49 AM
Declared Functions skipper23 PHP 4 12-17-03 10:06 AM
index page not showing up skipper23 PHP 3 12-15-03 01:10 PM
change my field in this example sal21 ASP 3 07-14-03 02:49 AM


All times are GMT -5. The time now is 03:04 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.