View Full Version : ASP/SQL - Problem

02-16-2007, 11:35 AM

I am designing a small advertisement management program in asp, and Sql Server 2000 as database.

My table has the following fields which are pretty self explanatory:

bannerId, bannertitle, bannerurl, imageURL, bannerpirority

bannerId = Autoincrement to generate unique id for a banner ad
bannertitle = String title of the banner
bannerurl = URL where the image is linked
imageURL = URL of the image file
bannerpirority = pirority of the banner to be displayed (1 = lowest, 5 = highest)

Now, I want to display the banner on a page based on its pirority, like if there are 3 banners A, B, C which have the pirority 1,2,3 respectively so banner C should be displayed more times as compared to banner B. Banner B should be displayed more times then banner A

Hope you got me, its like the more pirority a banner gets, the more its being displayed.

I am using the following SQl Query but I dnt think its the proper logic, can u plz help me?

select top 1 * from tbl_banner_management order by newid(), bannerpirority desc

Thanx in advance for your help.

02-16-2007, 12:44 PM
You know that ASP has an AdRotator component, that does exactly what you're doing, included as standard, right?


02-16-2007, 12:48 PM
i know about this component but i want to create my own


02-28-2007, 07:07 AM

I have not yet received a satisfying reply so far :(

Ok lets tweak this a lil bit.

we can have a percentage based ad management system.

Like I have 3 banners in my database.

Banner A - To receive 50% Views
Banner B - To receive 30% Views
Banner C - To receive 20% Views

So suppose I refresh the page 10 times, I should get the following views of my banners

Banner A - 5 views
Banner B - 3 views
Banner C - 2 Views

Can u guys help me with this?

Thanx in advance

02-28-2007, 11:50 AM
And I will say to you again: you're wasting your time.

I don't think you appreciate just how complex the specific bit of functionality that you're talking about really is. It's not simply a case of calculating 30% of 10. And it is probably for precisely this reason that Micro$oft, in their infinite goodness, decided to include this very, very complex bit of code as a component in its own right. And I guarantee you; even if you did figure out a way to do it, it won't run nearly as fast as the component.

By all means develop an application for managing advertisement assets: for storing images; mapping them to campaign URLs; tracking clickthroughs and conversion rates; generating the code that the adRotator component uses. I'm not saying that hasn't been done before, either, but... the reason you haven't received a "satisfying reply" is that everybody who's read this is wondering why on earth you'd want to even try it.

02-28-2007, 11:59 AM
Hello Spudhead,

Thanx for the reply.

Using the ad rotator component I can keep a track of how many clicks the ad has got but I dnt think there is any way to monitor how many views the banner has got.

Am I right?

02-28-2007, 12:29 PM
No, but you can work that out for yourself. You know your total pageviews at any one time (or should do if you've got some basic hit tracking on your pages), and you know from your adRotator configuration file what ratio of pageviews that ad has been shown on. It's the same logic you were discussing above, but in reverse.

02-28-2007, 12:42 PM
ummm...That doesn't make any sense :(