调用方式
1. .Banner(Width, Height)
.Banner方法是用来告诉Banner管理类程序你希望在客户端显示的是多大的Banner.
I. Width: <Banner宽度>
II. Height: <Banner高度>
2. .Click(Banner_ID, Banner_URL)
这个方法是程序员很少使用的.它是作用是用在客户端单击Banner统计
I. Banner_ID: <被单击Banner的编号>
II. Banner_URL: <Banner链接的网址,例如:BannerMaster.asp?ID=1&URL=www.banneryouselected.com>
创建一个名为BannerMaster的数据库或<a href="http://asp-code.aspsamples.com/fpdb/BannerMaster.mdb">Download</a>
在新数据库中添加下面的列
" Banner_ID [1...2...3..]Int Don"t allow NULLs and Check Identity Seed 1
" Banner_Vendor [ex Monster.com] Varchar 50 Allow NULLs
" Banner_Width [ex 468] int AllowNULLs
" Banner_Height [ex 60] int AllowNULLs
" Banner_Alt [ex Monster Job Search] Varchar 50 AllowNULLs
" Banner_URL [ex www.monster.com] Varchar 50 AllowNULLs
" Banner_File [ex monster_logo-1.gif] Varchar 50 AllowNULLs
" Banner_Path [ex images/ads/] Varchar 50 AllowNULLs
" Banner_Imp_Purchased [ex 10000] Varchar 50 AllowNULLs Default 1000
" Banner_Imp_Current [ex 2343] Varchar 50 AllowNULLs Default 1
" Banner_Imp_Total [ex 120034] Varchar 50 AllowNULLs Default 1
" Banner_CT_Current [ex 23] Varchar 50 AllowNULLs Default 1
" Banner_CT_Total [ex 1200] Varchar 50 AllowNULLs Default 1
" Banner_CT_Percent [ex 1.01] Varchar 50 AllowNULLs Default 0
" Banner_Account_Active [ex True] Varchar 50 AllowNULLs Default True
将Banner添到数据库.
创建名为BannerMaster.asp 的文件,代码如下:
<!-- #include virtual="BannerMasterTestClass.asp" -->
<%
Dim Banner_URL
Dim Banner_ID
Banner_URL = Request("B")
Banner_ID = Request("ID")
Call bm.Click(Banner_ID, Banner_URL)
Response.Redirect "HTTP://" & Banner_URL
%>
创建名为BannerMasterTestClass.asp的包含文件,代码如下:
<%
"*******************************************************************************
"打开数据库
"*******************************************************************************
"定义连接数据变量
dim Server_IP
dim Database_Name
dim Table_Name
dim User_Name
dim Password
Server_IP = "xx.xx.xx.xx"
Database_Name = "BANNER_DATABASE"
Table_Name = "BANNER_MASTER"
User_Name = "Logon_Name"
Password = "User_Password"
Set DBConnection = Server.CreateObject("adodb.connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; "
DSN = DSN & "DBQ=" & Server.Mappath("BannerMaster.mdb")
DSN = DSN & ";UID="&User_Name&";PWD="&Password
DBConnection.Open DSN
"*******************************************************************************
"创建类
"*******************************************************************************
Class BannerMasterClass
Public Error_Trapping_On
Public SQL_Debug
Public BannerArray "Avb outside of function
Public Number_Of_Banners
"*******************************************************************************
"*******************************************************************************
"类初始化
"*******************************************************************************
Private Sub Class_Initialize()
If SQL_Debug = True Then
Response.write "Defaults Set <br>"
End If
End Sub
"*******************************************************************************
" Banner Master
"******************