Solved

Show region if recordset is empty

Posted on 2006-06-28
2
343 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 500 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Suggested Solutions

Title # Comments Views Activity
SWF won't scale? 4 530
Dreamweaver CC no database behaviors or connections possible ? 10 4,321
installing adobe creative cloud offline 4 6,649
.dwt files not viewable in browser - why? 2 122
I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

730 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