Print Page | Close Window

Problem With else Statement

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=28432
Printed Date: 28 March 2026 at 6:01am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Problem With else Statement
Posted By: kennywhite
Subject: Problem With else Statement
Date Posted: 16 March 2010 at 8:15pm

I have tried placing my else statement in two separate places in the below code. I have commented out the places where I have tried to place it. My else statement is simply
response.write ("There is nothing to display")


When I tried to put in both of these places it broke the code. Where should I place it?



<%
function complete()

'Dimension variables
Dim adoCon        'Holds the Database Connection Object
Dim rsProject    'Holds the recordset for the records in the database
Dim strSQL        'Holds the SQL query to query the database


'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("projects.mdb")

'Create an ADO recordset object
Set rsProject = Server.CreateObject("ADODB.Recordset")

'Initialise the strSQL variable with an SQL statement to query the database DESCending order
strSQL = "SELECT projects.ProjectTitle, projects.TargetDate, projects.SubmittedBy, projects.PostedDate, projects.CompletedBy, projects.Priority, projects.CompletedDate, projects.Completed, projects.Notes, projects.ID FROM projects WHERE Completed = true ORDER BY projects.Priority DESC, projects.TargetDate, projects.PostedDate, projects.ProjectTitle ;"

'Open the recordset with the SQL query
rsProject.Open strSQL, adoCon




'Loop through the recordset
Do While not rsProject.EOF

'Sets table colors
if iLoop = 2 then iLoop = 0
if iLoop = 1 then   



<!-- ELSE STATEMENT HERE -->







end if


%>

<div class="d_blog" style="width:700px;">
<a href="project.asp?ID=<% Response.Write (rsProject("ID"))%>" style="text-decoration : none;">
<h1 class="content_header"><%Response.Write (rsProject("ProjectTitle"))%></a></h1>
<table width="100%"><tr><td width="590" valign="bottom">
<strong>
Targeted Completion Date:</b> <% Response.Write (rsProject("TargetDate")) %>
</strong></td>
<td>
Priority Level: <% Response.Write (rsProject("Priority")) %>
</td></tr></table>
<hr>
<%Response.Write (rsProject("Notes"))%>
 <p>
<hr>
<table width="100%"><tr><td width="550">
Submitted By: <%Response.Write (rsProject("SubmittedBy"))%>

</td> <td>
Posted On:
<% Response.Write (rsProject("PostedDate")) %>
</td></tr></table>    
</div>

<%

'Loop tables
iLoop = iLoop + 1



    'Move to the next record in the recordset

    rsProject.MoveNext


Loop








<!-- ELSE STATEMENT HERE -->









'Reset server objects
rsProject.Close
Set rsProject = Nothing
Set adoCon = Nothing




end function

%>



Replies:
Posted By: Scotty32
Date Posted: 20 March 2010 at 12:42pm
What is the error you are receiving, the error line and which line this relates to.


-------------
S2H.co.uk - http://www.s2h.co.uk/wwf/" rel="nofollow - WebWiz Mods and Skins

For support on my mods + skins, please use http://www.s2h.co.uk/forum/" rel="nofollow - my forum .



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net