Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Show region if recordset is empty

Posted on 2006-06-28
2
Medium Priority
?
346 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

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…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

609 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