ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old June 18th, 2003, 04:00 PM
merlinti's Avatar
merlinti merlinti is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Miami, FL
Posts: 134 merlinti User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 24 m 17 sec
Reputation Power: 6
on error resume next, how to show the rest of the page HTML

Hi All,

I'm on the last piece of this project, when a user goes to this page "myfolder.asp" it shows the contents of their folder.
If they don't have one created yet, I want to give them a friendly message: "You have nothing in your folder!" , and continue with the rest of the HTML code, but then ignore the Repeat Regions and dynamic text thats inside the HTML.

Right now I have it woking if the table exists, it shows the records.
If I delete the table, I have this message at the top of the screen and nothing else: "You have nothing in your folder!"


Here is the code:

Code:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/streetguide.asp" -->



<%
'/////////////////////////////////////////////////////////////////////////
' *** Restrict Access To Page: Grant or deny access to this page

MM_authorizedUsers="1"
MM_authFailedURL="../login.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
  If (false Or CStr(Session("MM_UserAuthorization"))="") Or _
         (InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
    MM_grantAccess = true
  End If
End If
If Not MM_grantAccess Then
  MM_qsChar = "?"
  If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
  MM_referrer = Request.ServerVariables("URL")
  if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
  MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
  Response.Redirect(MM_authFailedURL)
End If

'/////////////////////////////////////////////////////////////////////////////////
%>


<%
'/////////////////////////////////////////////////////////////////////////////////
' ***  rsMember Recordset  ***

Dim rsMember__strUserName
rsMember__strUserName = "xyz"
If (Session("MM_UserName")  <> "") Then 
  rsMember__strUserName = Session("MM_UserName") 
End If
%>
<%
Dim rsMember
Dim rsMember_numRows

Set rsMember = Server.CreateObject("ADODB.Recordset")
rsMember.ActiveConnection = MM_streetguide_STRING
rsMember.Source = "SELECT *  FROM streetguide.members  WHERE UserName = '" + Replace(rsMember__strUserName, "'", "''") + "'"
rsMember.CursorType = 0
rsMember.CursorLocation = 2
rsMember.LockType = 1
rsMember.Open()
rsMember_numRows = 0
UserName = rsMember.Fields.Item("UserName" ).Value

'////////////////////////////////////////////////////////////////////////////////
%>



<%
'////////////////////////////////////////////////////////////////////////////////
' ***  rsMyFolder Recordset  ***

Dim rsMyFolder
Dim rsMyFolder_numRows

Set rsMyFolder = Server.CreateObject("ADODB.Recordset" )
rsMyFolder.ActiveConnection = MM_streetguide_STRING
rsMyFolder.Source = "SELECT * FROM "& UserName
rsMyFolder.CursorType = 0
rsMyFolder.CursorLocation = 2
rsMyFolder.LockType = 1
On Error Resume Next 
rsMyFolder.Open()
rsMyFolder_numRows = 0

If Err.Number <> 0 Then 

'Print error message to user 
Response.Write "You have nothing in your folder!" 
Response.End 

End If 

'////////////////////////////////////////////////////////////////////////////////
%>

<%
'////////////////////////////////////////////////////////////////////////////////
' ***  rsMyFolder Repeat Region  ***

Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rsMyFolder_numRows = rsMyFolder_numRows + Repeat1__numRows

'////////////////////////////////////////////////////////////////////////////////
%>




<html>
<head>
<title>Directions Steet Guide - Members Home</title>
<link href="../assets/css/streets.css" rel="stylesheet" type="text/css">

</head>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div align="center">
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td background="../assets/images/main_btm_outerBG.jpg">&nbsp;</td>
      <td width="750" valign="top" background="../assets/images/main_bg01_btm.jpg"><div align="center">
        <table width="100%" border="0" cellspacing="6" cellpadding="6">
          <tr>
            <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="MemberLinkBG">
              <tr>
                <td width="5">&nbsp;</td>
                <td width="270"><p><span class="WelcomeBackTxt">Welcome back</span><font color="#FFFFFF"> </font><span class="WelcomeBackTxt"><%=(rsMember.Fields.Item("FirstName").Value)%></span></p>
                </td>
                <td><p align="right"><a href="streetsearch.asp" class="MemberLinks"><font color="#FFFFFF" size="1"> </font> </a></p>
                </td>
                <td width="5">&nbsp;</td>
              </tr>
            </table>            <p><span class="Title"> &nbsp;My Folder &nbsp;<img src="../assets/images/title_icon02.gif" width="13" height="11"> <img src="../assets/images/title_icon02.gif" width="13" height="11"> <img src="../assets/images/title_icon02.gif" width="13" height="11"> </span></p>
            
            
            
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="BorderBtmMyfolder">
              <tr>
                <td>&nbsp;</td>
              </tr>
            </table>
            <% While ((Repeat1__numRows <> 0) AND (NOT rsMyFolder.EOF)) %>
			
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="BorderBtmMyfolder">
<%If (Repeat1__numRows Mod 2) Then%>
     <tr style="background-color:#D5DADB"> 
<%Else%> 
     <tr style="background-color:#C5CCCF"> 
<%End If%>
                    <td width="25" valign="middle"><div align="center"><a href="deletefromfolder.asp?FolderID=<%=(rsMyFolder.Fields.Item("FolderID").Value)%>&UserName=<%=(rsMember.Fields.Item("UserName").Value)%>"><img src="../assets/images/buttons/delete.gif" alt="Delete" width="23" height="23" border="0"></a>
                      </div>
                    </td>
                    <td><p><span class="StreetMyFolder"><%=(rsMyFolder.Fields.Item("StreetName").Value)%></span>, <%=(rsMyFolder.Fields.Item("Block").Value)%>, <%=(rsMyFolder.Fields.Item("City").Value)%>, <%=(rsMyFolder.Fields.Item("Direct1").Value)%>, <%=(rsMyFolder.Fields.Item("Direct2").Value)%>, <%=(rsMyFolder.Fields.Item("Cross2").Value)%>, <%=(rsMyFolder.Fields.Item("Direct3").Value)%>, <%=(rsMyFolder.Fields.Item("Zip").Value)%></p>
                    </td>
                </tr>
                </table>
            <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rsMyFolder.MoveNext()
Wend
%>

            <p>&nbsp;              </p>
            <p align="center"></p>
            <p></p>
            <p>&nbsp;</p>
              </td>
          </tr>
        </table>
        <p align="left">&nbsp;</p>
        </div>
      </td>
      <td background="../assets/images/main_btm_outerBG.jpg">&nbsp;</td>
    </tr>
  </table>
  <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td background="../assets/images/main_btm_outerBG.jpg">&nbsp;</td>
      <td width="750" valign="top" background="../assets/images/bottom.jpg"><div align="left"><img src="../assets/images/blank.gif" width="22" height="35" align="absmiddle"> <span class="BottomText">© 2003
            Directions™</span><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><img src="../assets/images/blank.gif" width="450" height="35" align="middle"></font><span class="BottomText">Website
            by Computer Intellect</span></div></td>
      <td background="../assets/images/main_btm_outerBG.jpg">&nbsp;</td>
    </tr>
  </table>
</div>
</body>
</html>

<%
rsMember.Close()
Set rsMember = Nothing
%>
<%
rsMyFolder.Close()
Set rsMyFolder = Nothing
%>


Last edited by merlinti : June 18th, 2003 at 04:06 PM.

Reply With Quote
  #2  
Old June 18th, 2003, 10:08 PM
merlinti's Avatar
merlinti merlinti is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Location: Miami, FL
Posts: 134 merlinti User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 24 m 17 sec
Reputation Power: 6
OK, I got this figured out with the help of you Gurus out there.


I just learned that you can seperate the HTML from ASP script and resume the code later on.

Here is the code:


Code:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="blahblah.asp" -->



<%
'/////////////////////////////////////////////////////////////////////////
' *** Restrict Access To Page: Grant or deny access to this page

MM_authorizedUsers="1"
MM_authFailedURL="../login.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
  If (false Or CStr(Session("MM_UserAuthorization"))="") Or _
         (InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
    MM_grantAccess = true
  End If
End If
If Not MM_grantAccess Then
  MM_qsChar = "?"
  If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
  MM_referrer = Request.ServerVariables("URL")
  if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
  MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
  Response.Redirect(MM_authFailedURL)
End If

'/////////////////////////////////////////////////////////////////////////////////
%>


<%
'/////////////////////////////////////////////////////////////////////////////////
' ***  rsMember Recordset  ***

Dim rsMember__strUserName
rsMember__strUserName = "xyz"
If (Session("MM_UserName")  <> "") Then 
  rsMember__strUserName = Session("MM_UserName") 
End If
%>
<%
Dim rsMember
Dim rsMember_numRows

Set rsMember = Server.CreateObject("ADODB.Recordset")
rsMember.ActiveConnection = MM_streetguide_STRING
rsMember.Source = "SELECT *  FROM streetguide.members  WHERE UserName = '" + Replace(rsMember__strUserName, "'", "''") + "'"
rsMember.CursorType = 0
rsMember.CursorLocation = 2
rsMember.LockType = 1
rsMember.Open()
rsMember_numRows = 0
UserName = rsMember.Fields.Item("UserName" ).Value

'////////////////////////////////////////////////////////////////////////////////
%>




<---   HTML stuff here   --->




<%
'////////////////////////////////////////////////////////////////////////////////
' ***  rsMyFolder Recordset  ***

Dim rsMyFolder
Dim rsMyFolder_numRows

Set rsMyFolder = Server.CreateObject("ADODB.Recordset" )
rsMyFolder.ActiveConnection = MM_streetguide_STRING
rsMyFolder.Source = "SELECT * FROM "& UserName
rsMyFolder.CursorType = 0
rsMyFolder.CursorLocation = 2
rsMyFolder.LockType = 1
On Error Resume Next 
rsMyFolder.Open()
rsMyFolder_numRows = 0

If Err.Number <> 0 Then 

'Print error message to user 
strResponse = "You have nothing in your folder!" 

%>




<---   HTML stuff here   --->

<p align="center"><%= strResponse %>&nbsp;</p>

<---   HTML stuff here   --->




<%
'If there is a table and records do this...
Else

'////////////////////////////////////////////////////////////////////////////////
' ***  rsMyFolder Repeat Region  ***

Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
rsMyFolder_numRows = rsMyFolder_numRows + Repeat1__numRows

'////////////////////////////////////////////////////////////////////////////////
%>




            <% While ((Repeat1__numRows <> 0) AND (NOT rsMyFolder.EOF)) %>
			
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="BorderBtmMyfolder">
<%If (Repeat1__numRows Mod 2) Then%>
     <tr style="background-color:#D5DADB"> 
<%Else%> 
     <tr style="background-color:#C5CCCF"> 
<%End If%>
                    <td width="25" valign="middle"><div align="center"><a href="deletefromfolder.asp?FolderID=<%=(rsMyFolder.Fields.Item("FolderID").Value)%>&UserName=<%=(rsMember.Fields.Item("UserName").Value)%>"><img src="../assets/images/buttons/delete.gif" alt="Delete" width="23" height="23" border="0"></a>
                      </div>
                    </td>
                    <td><p><span class="StreetMyFolder"><%=(rsMyFolder.Fields.Item("StreetName").Value)%></span>, <%=(rsMyFolder.Fields.Item("Block").Value)%>, <%=(rsMyFolder.Fields.Item("City").Value)%>, <%=(rsMyFolder.Fields.Item("Direct1").Value)%>, <%=(rsMyFolder.Fields.Item("Direct2").Value)%>, <%=(rsMyFolder.Fields.Item("Cross2").Value)%>, <%=(rsMyFolder.Fields.Item("Direct3").Value)%>, <%=(rsMyFolder.Fields.Item("Zip").Value)%></p>
                    </td>
              </tr>
            </table>
            <% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  rsMyFolder.MoveNext()
Wend
%>
            <% If rsMyFolder.EOF And rsMyFolder.BOF Then %>
            <table width="100%" border="0" cellpadding="0" cellspacing="0" class="BorderBtmMyfolder">
              <tr style="background-color:#D5DADB">
              <tr style="background-color:#C5CCCF">
                <td width="25" valign="middle"><div align="center"> </div>
                </td>
                <td><p align="center"><%= strResponse %>&nbsp;Your Folder Is Empty</p>
                </td>
              </tr>
                        </table>
            <% End If ' end rsMyFolder.EOF And rsMyFolder.BOF %>

            <p>&nbsp;              </p>
            <p align="center"></p>
            <p></p>
            <p>&nbsp;</p>
              </td>
          </tr>
        </table>
        <p align="left">&nbsp;</p>
</div>
      </td>
      <td background="../assets/images/main_btm_outerBG.jpg">&nbsp;</td>
    </tr>
  </table>
  
</div>
</body>
</html>
<%
rsMember.Close()
Set rsMember = Nothing
%>
<%
rsMyFolder.Close()
Set rsMyFolder = Nothing
%>
<%End If
%>





Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > on error resume next, how to show the rest of the page HTML


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
Accelerating Trading Partner Performance
One in five. That's how many partner transactions have at least one error. That is an amazing statistic, particularly given the extraordinary leaps in innovation across the global supply chain during the past two decades. Download this white paper to learn more.

 
Competing on Analytics
This Tech Analysis is designed to help identify characteristics shared by analytics competitors, and includes information about 32 organizations that have made a commitment to quantitative, fact-based analysis.

 
Cost Effective Scaling with Virtualization and Coyote Point Systems
An overview of the industry trend toward virtualization, how server consolidation has increased the importance of application uptime and the steps being taken to integrate load balancing technology with virtualized servers.

 
Five Checkpoints to Implementing IP Telephony
Implementation planning for IP PBX software and IP telephony has become vital as businesses replace discontinued legacy PBX phone systems. This informative whitepaper outlines five "checkpoints" for any implementation plan that will help make IP communications a successful proposition.

 
Hosted Email Security: Staying Ahead of New Threats
In the last two years, email has become a fierce battleground between the nefarious forces of spam and malware, and the heroes of messaging protection. The spam volumes increased alarmingly every month, bringing clever new forms of phishing and virus propagation attacks.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway