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
%>
|