Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Problem With else Statement
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Problem With else Statement

 Post Reply Post Reply
Author
kennywhite View Drop Down
Groupie
Groupie


Joined: 26 February 2009
Location: Indy
Status: Offline
Points: 106
Post Options Post Options   Thanks (0) Thanks(0)   Quote kennywhite Quote  Post ReplyReply Direct Link To This Post Topic: Problem With else Statement
    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

%>
Back to Top
Scotty32 View Drop Down
Moderator Group
Moderator Group


Joined: 30 November 2002
Location: Manchester, UK
Status: Offline
Points: 1682
Post Options Post Options   Thanks (0) Thanks(0)   Quote Scotty32 Quote  Post ReplyReply Direct Link To This Post 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 - WebWiz Mods and Skins

For support on my mods + skins, please use my forum.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.