ASP
  Home arrow ASP arrow The Real Basics of Functions in ASP
Iron Speed
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Download TestComplete 
Windows Web Hosting
 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP

The Real Basics of Functions in ASP
By: John Puddifoot
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 256
    2004-12-21

    Table of Contents:
  • The Real Basics of Functions in ASP
  • Simplemaths
  • Customer Spec Part 2
  • A Common ASP Task
  • Calling the Function

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    Iron Speed
     
    ADVERTISEMENT

    Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!

    The Real Basics of Functions in ASP
    (Page 1 of 5 )

    Re-usable code is a boon to developers. It's easy to manage, because it only needs to be written once; then, every time you want to do the same thing, you just call it up again. However, it does require a bit of thought and planning up front. John Puddinfoot walks us through several simple applications for re-usable code in ASP, focusing on functions.

    As with every design decision, the choice to develop re-usable code is a matter of trade-off. Making the decision to develop re-usable code will help to produce more robust and maintainable solutions, but may require a little more time and thinking up front.

    In many ways ASP is an unstructured language. The language itself does not constrain a developer to design something in a particular way, which again has its good points and its bad points. The emphasis is on the developer to apply hisr own style to the work. Functions provide developers with an option to produce code that can be used time and time again within a project and beyond, yet many ASP developers tend to shy away from using them extensively.

    This article will introduce the basic concepts of functions within ASP, and we’ll go on to produce a very useful function to demonstrate the concept. To start us off, here's a very simple piece of work: doing some very basic maths to demonstrate that even with the simplest of coding tasks, functions have a real use.

    Customer Spec: "Here’s the idea John, we have two values which we need to add together and display the result on the screen."

    It’s a simple enough concept. We’ll take two numbers and add them together to create a result then display this to the screen. First we’ll do it the natural way. We’ll code it straight out – all two lines of code!

    Without functions:

    <%
    result=2+2
    response.write result & "<br />"
    %>

    More ASP Articles
    More By John Puddifoot


       · The code works great to add new records to a database. However, if you need to...
       · Here is the most valuable function for asp. Place this into global.asas or a...
       · function db_dropdown(sTable, sId, sDropdownName, sBoundfield,...
       · What does the value of "sID" represent? Is it the value of the field from Table1 in...
       · ' Create a suitable connection object for a given connection string. Function...
       · ' Create a suitable connection object for a given connection string. Function...
       · This is very good but i don't why this doesn't work???
       · simple... but VERY cool.
       · I have problem to seek them, because I don't have this software...?
       · function db_dropdown(tablename, bound_field, display_field,order_field,...
     

    ASP ARTICLES

    - ADO for the Beginner
    - ADO.NET 101: Data Rendering with a DataGrid ...
    - Introducing SoftArtisans OfficeWriter 3.0 En...
    - Getting Remote Files With ASP
    - The Real Basics of Functions in ASP
    - Enhancing Readability with ASP
    - Mimicking PHP's String Formatting Functions
    - Windows Server Hacks 12, 77, and 98
    - How to Sort a Multi-Dimensional Array
    - Developing an Information Management Tool wi...
    - What are Active Server Pages?
    - Getting Remote Pages with ASP
    - FTP’ing Files with ASP
    - Apply Single-Sign-On to Your Application
    - Easy Error Management




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