?
Solved

Show region if recordset is empty

Posted on 2006-06-28
2
Medium Priority
?
345 Views
Last Modified: 2011-09-20
I am creating a Positions Vacant section of a site using Dreamweaver and asp, and the job records are retrieved from an access database.
I need to have a "No Jobs currently listed" message appear when a certain category of positions pulls no records, rather than a blank page.
I am trying to use the "Show region if recordset is empty" facility in Dreamweaver, but I keep getting the message "Before using this behaviour, please create a recordset", although I believe I have. Why is this? Does it matter where I place the "No Jobs Currently listed" message?

This is my asp code on the page:


                        <%
Dim mySQL, mySQLOrder
myDSN = "DBQ=" & Server.MapPath ("positiondatabase.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
mySQL = "SELECT * From [JobDetails] Where [JobIndustryID]= "& Request.QueryString("JobIndustryID")
Select Case Request.QueryString("SortField")
   case "JobDateListed"
      mySQLOrder = " ORDER BY [JobDateListed]desc"
   case "JobTitle"
      mySQLOrder = " ORDER BY [JobTitle]"
   case "JobSuburb"
      mySQLOrder = " ORDER BY [JobSuburb]asc"
   case else
      mySQLOrder = " ORDER BY [JobDateListed]desc"
End Select

Set JobDetailsRS = Server.CreateObject("ADODB.RecordSet")
JobDetailsRS.Open mySQL & mySQLOrder, myDSN
%>
        <%
myDSN = "DBQ=" & Server.MapPath ("positiondatabase.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
mySQL = "SELECT * From [JobIndustry] Where [ID]= "& Request.QueryString("JobIndustryID") & ";"
Set JobIndustryRS = Server.CreateObject("ADODB.RecordSet")
JobIndustryRS.Open mySQL, myDSN
%>

And the fields required to be displayed are placed within the following:

<%Do While Not JobDetailsRS.EOF %>
...........

   <%JobDetailsRS.MoveNext
  Loop%>      
0
Comment
Question by:AndyPaige
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Accepted Solution

by:
WMIF earned 2000 total points
ID: 17005834
not sure how dreamweaver handles it, but in asp, you just need to test for records being present.

       <%
myDSN = "DBQ=" & Server.MapPath ("positiondatabase.mdb") & ";Driver={Microsoft Access Driver (*.mdb)};"
mySQL = "SELECT * From [JobIndustry] Where [ID]= "& Request.QueryString("JobIndustryID") & ";"
Set JobIndustryRS = Server.CreateObject("ADODB.RecordSet")
JobIndustryRS.Open mySQL, myDSN
%>

And the fields required to be displayed are placed within the following:

<%
if JobDetailsRS.EOF then
  ' no records found
  response.write "No Jobs currently listed"
else
  Do While Not JobDetailsRS.EOF %>
...........

   <%JobDetailsRS.MoveNext
  Loop
end if
%>    
0
 

Author Comment

by:AndyPaige
ID: 17005899
Thank you WMIF.
Perfect!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those who don't know, Adobe Dreamweaver is a popular commercial web editor that enables you to design, build and manage complex websites. The editor is a WYSIWYG (What You See Is What You Get) web editor, which means that you can create your web…
This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question