Home arrow ASP arrow Page 6 - Make Revenue With Your Own Banner Management System

Make Revenue With Your Own Banner Management System

In this article Mitchell shows us how to develop a simple ad campaign and management system using ASP and an SQL Server database.

Author Info:
By: Mitchell Harper
Rating: 5 stars5 stars5 stars5 stars5 stars / 33
November 01, 2001
  1. · Make Revenue With Your Own Banner Management System
  2. · Adding the banners
  3. · Saving the banners
  4. · The ASP to add the banner
  5. · The ASP to add the banner (contd)
  6. · Listing the banners
  7. · Deleting a banner
  8. · Displaying and tracking banners, impressions and click-thrus
  9. · The code in detail
  10. · Handling the banner clicks
  11. · Conclusion

print this article

Make Revenue With Your Own Banner Management System - Listing the banners
(Page 6 of 11 )

Believe it or not, we've overcome the hardest part of our coding! For this step, we want to create a list of banners in our rotation, and we also want to be able to delete a banner if we need to. Lets start by creating a simple ASP script that will show our banners in a table on a HTML page. The code for banner.asp (described below) is part of the support material for this article and can be downloaded from the last page.

dim objComm


set objComm = Server.CreateObject("ADODB.Command")


objComm.ActiveConnection = objConn

objComm.CommandType = adCmdText

In this part of our ASP script, we are introducing a new database object called a command object. A command object is used to parse commands to SQL server. These commands can either be stored procedures, text commands, commands held in files, etc. For our banner system, we're only interested in passing plain old text queries to SQL server. To do this, we set the CommandType parameter of our command object (objComm) to adCmdText, meaning this: "Any query that is passed to SQL server should be interpreted as plain text".

Through the command object, we get a list of all of our banners using a simple select query. The results for the query are stored in our recordset object (objRS). This is shown below:

objComm.CommandText = "select * from banners order by bannerName asc"

set objRS = objComm.Execute

Now that we have a list of rows in our recordset object, we can loop through each row, and display the data in our HTML table. We will display a link to delete the banner (explained later), the banners name, impression and click-thru numbers, and image. Remember to change the strBanner_Path variable to the directory where you saved your banners.

strBanner_Path = "c:\inetpub\wwwroot\banners"


while not objRS.EOF







If all goes well, you'll be presented with a list of banners in your database, just like the one shown below:

Table listing banners retrieved from the database
blog comments powered by Disqus

- Central Scoreboard with Flash and ASP
- Calorie Counter Using WAP and ASP
- Creating PGP-Encrypted E-Mails Using ASP
- Be My Guest in ASP
- Session Replacement in ASP
- Securing ASP Data Access Credentials Using t...
- The Not So Ordinary Address Book
- Adding and Displaying Data Easily via ASP an...
- Sending Email From a Form in ASP
- Adding Member Services in ASP
- Removing Unconfirmed Members
- Trapping HTTP 500.100 - Internal Server Error
- So Many Rows, So Little Time! - Case Study
- XDO: An XML Engine Class for Classic ASP
- Credit Card Fraud Prevention Using ASP and C...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials