Solved

Show region if recordset is empty

Posted on 2006-06-28
2
338 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
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
pin image to base of site 14 361
Remove LF from html text 5 417
Create recordset using Dreamweaver PHP and MS SQL 2008 4 549
Site contents shift off page in IE 32 130
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 …
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

777 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