473,394 Members | 1,878 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

how to add a brief message when a page is blank

114 100+
the page below is called "todays newslog" and it automatically draws out news articles posted within a 24 hour period. It is an asp page updated each midnight.

During the time Midnight to whenver the first article is added, the page is blank. I would like to add this statement to the blank page only, so that it doesn't show after the first article is added. ie. it should only until news is added.

"No news added yet. please check later"

I would appreciate some suggestions, as to what code to add and where. Here is the code of the page below

Thanks in advance.


Expand|Select|Wrap|Line Numbers
  1. <!--#include file="inc_header.asp"--> 
  2.  
  3.  
  4. <% Dim SetDate, EndDate, QueryDate, CATEGORIES, POP_DROP
  5.  
  6.     QueryDate = Request.QueryString("D")
  7.  
  8.     If IsDate(QueryDate) THEN    
  9.         QueryDate = CDate(QueryDate)    
  10.     ELSe
  11.         QueryDate = Date()
  12.     END IF
  13.  
  14.     SetDate = QueryDate
  15.     EndDate = QueryDate + 1    
  16.  
  17.  
  18.     Call OPEN_DB()        
  19.  
  20.     SQL = "SELECT fldCREATED FROM nm_tbl_news GROUP BY fldCREATED ORDER BY fldCREATED DESC"
  21.     Set RS = Server.CreateObject("ADODB.Recordset")
  22.     RS.LockType   = 1 
  23.     RS.CursorType = 0 
  24.     RS.Open SQL, MyConn    
  25.          WHILE NOT RS.EOF 
  26.              blSEL = ""
  27.              If NOT Instr(POP_DROP, FormatDateTime(RS("fldCREATED"),2)) > 0 THEN
  28.                 'IF Trim(QueryDate) = Trim(FormatDateTime(RS("fldCREATED"),2)) THEN blSEL = " selected"
  29.                  POP_DROP = POP_DROP & "<option " & blSEL & " value='TodaysWeblog.asp?D=" & FormatDateTime(RS("fldCREATED"),2) & "'>" & FormatDateTime(RS("fldCREATED"),2) & vbcrlf
  30.             END IF
  31.             RS.MoveNext
  32.          WEND
  33.     RS.Close 
  34.     Set RS = Nothing
  35.         Dim DATE_F
  36.         DATE_F = GET_SETTINGS(False, "fldDATE_F")
  37.  
  38. %>
  39.  
  40. <script language="JavaScript" type="text/javascript">
  41.     function Jump(fe){
  42.         var opt_key = fe.selectedIndex;
  43.         var uri_val = fe.options[opt_key].value;
  44.         window.open(uri_val,'_top');
  45.         return true;
  46.     }
  47. </script>
  48.  
  49.  
  50. <table width="752" align="center" cellpadding="2" cellspacing="0" border="0">
  51.   <tr>    <td width="628" align="left" valign="top"><table width="592">
  52.       <tr>
  53.         <th width="237" align="left" scope="col"><img src="../pix/tout/todaysweblog.JPG" alt="todays news" width="150" height="21" align="top"></th>
  54.         <th width="379" align="left" valign="bottom" scope="col"><span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif">&nbsp;&nbsp;<span style="font-size: 9px; font-style: italic">updated every midnight </span> </span></span><strong style="font-size: 12px;"><span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif"><strong style="font-size: 12px;">&nbsp;&nbsp;&nbsp; <%=QueryDate%></strong></span>&nbsp;</strong><span style="font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 9px; color: #808080">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><strong style="font-size: 12px;"> <br />
  55.         </strong></th>
  56.       </tr>
  57.     </table>
  58.  
  59.       <table width="595" height="199" align="left" cellpadding="2" cellspacing="2">
  60.         <% Dim I 
  61.  
  62.         I = 1
  63.         SQL = "SELECT nm_tbl_news.ID AS NID, nm_tbl_news.fldSUMMARY AS SUMMARY, nm_tbl_news.fldIMAGE AS NIMAGE, nm_tbl_news.fldTITLE AS TITLE, nm_tbl_agent.fldNAME AS ANAME, nm_tbl_news.fldPOSTED AS POSTED, fldCREATED FROM nm_tbl_news, nm_tbl_agent WHERE (nm_tbl_agent.ID = nm_tbl_news.fldAID) AND (nm_tbl_news.fldACTIVE=1) AND (fldCREATED > #" & SetDate & "# AND fldPOSTED < #" & EndDate & "# ) AND (Now() BETWEEN fldCREATED AND fldEXPIRES) ORDER BY nm_tbl_news.fldPOSTED DESC"        
  64.  
  65.         Set RS = Server.CreateObject("ADODB.Recordset")
  66.         RS.LockType   = 1
  67.         RS.CursorType = 0
  68.         RS.Open SQL, MyConn    
  69.              WHILE NOT RS.EOF                  
  70.                 NID     = trim(RS("NID"))
  71.                 SUMMARY = trim(RS("SUMMARY"))
  72.                 IMAGE   = trim(RS("NIMAGE"))
  73.                 TITLE   = trim(RS("TITLE"))
  74.                 AUTHOR  = trim(RS("ANAME"))
  75.                 POSTED  = trim(RS("POSTED"))    
  76.                 CREATED  = trim(RS("fldCREATED"))
  77.                 CATEGORIES = GET_CATES(NID)                
  78.                 %>
  79.         <%'IF Trim(FormatDateTime(POSTED,2)) = Trim(SetDate) THEN%>
  80.         <%IF I = 1 THEN%>
  81.         <tr>
  82.           <td width="585" height="98" align="left" valign="top" style="padding: 5px;"><a href="../news.asp?ID=<%=NID%>" class="NavigLNK"><%=TITLE%></a><br /> 
  83.  
  84.                 <span class="divPOSTEDON">Category: <%=CATEGORIES%></span><%END IF%> <br />
  85.  
  86.              <%IF NOT (IMAGE = "" OR IsNull(IMAGE)) THEN%>
  87.               <img src="<%=IMAGE%>" width="70" height="80" vspace="5" border="0" align="left" />
  88.               <% END IF %> <%= FormatDateTime(POSTED,DATE_F) %> <%IF SHOW_AUTHOR = True THEN%> 
  89.              &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [By: <%=AUTHOR%>]<br />
  90.               <span class="tdSUMMARY"><%= SUMMARY %> <br />
  91.               </span><br /><hr width="100%" size="1" style="color: gray ;height: 1px;" />
  92.           </td>
  93.         </tr>
  94.         <%ELSE%>
  95.         <tr>
  96.           <td width="585" align="left" valign="top" style="padding: 5px;; font-size: 12px"><div align="justify">
  97.               <%IF NOT (IMAGE = "" OR IsNull(IMAGE)) THEN%>
  98.               <img src="<%=IMAGE%>" width="50" height="50" border="1" />
  99.               <%ELSE%>
  100.             &nbsp;
  101.             <%END IF%>
  102.           </div></td>
  103.         </tr>
  104.         <%END IF%>
  105.         <%'END IF%>
  106.         <%
  107.                 I = I + 1
  108.                 IF I > 1 THEN I = 1                
  109.                 RS.MoveNext
  110.              WEND
  111.         RS.Close 
  112.         Set RS = Nothing
  113.  
  114.         MyConn.Close
  115.         Set MyConn = Nothing        
  116.  
  117.  
  118.         %>
Jan 11 '08 #1
1 1623
stepterr
157 100+
You could probably use

Expand|Select|Wrap|Line Numbers
  1. If rs.RecordCount = 0 Then 'no records found
  2.       ...do something...
  3. End If
  4.  
before you go into your while statement.
Jan 18 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Adam Barr | last post by:
For a book I am working on, I have written a brief (9 page) summary of Python. The intent of this is that an experienced programmer who did not know Python would be able to get enough information...
1
by: Adam Barr | last post by:
For a book I am working on, I have written a brief (13 page) summary of Perl. The intent of this is that an experienced programmer who did not know Perl would be able to get enough information to...
7
by: Albert Spencil | last post by:
This error shows when I check Netscape's "javascript:" . Doesn't seem to present a problem as the site works OK. Still I would like to get rid of it. "Security Error: Content at...
14
by: charlie_M | last post by:
Is there a way to blank the screen in a FORM's onsubmit=... to blank the screen for the user?? I asked this before and got a way to blank a table by id with ...
22
by: Adam Barr | last post by:
For a book I am working on, I have written a brief (7 page) summary of C. The intent of this is that an experienced programmer who did not know C would be able to get enough information to read and...
2
by: Helen | last post by:
Guys and gals, I am having a problem with an IFRAME that is embedded into an ASPX page (ASP.NET application). The IFRAME is originally empty (src=''). When a user selects a date from the...
0
by: Helen | last post by:
vb .net 2002 crystal reports 9 Hello: I have a subreport in the report footer of my main report. When the subreport has no records to show, I have a message in the subreport Group Footer...
0
by: Helen | last post by:
vb .net 2002 crystal reports 9 Hello: I have a subreport in the report footer of my main report. When the subreport has no records to show, I have a message in the subreport Group Footer...
16
by: whyyyy | last post by:
The script below works fine if the form is filled out and submitted. But a (blank) e-mail is sent whenever the page loads, even when the form is not submitted. I would like to receive the e-mail...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.