asp.net环境下的链接点击计数--方案2

var adCmdText="&H0001";
var adInteger=3;
var adParamInput="&H0001";

//上述的三个变量在操作系统目录下(%systemroot%/system32/adovbs.inc),vb中导入即可,如下句:

<%-- --%>(该语句已注释)
function IncreaseClicks(id)
{

var conn = new ActiveXObject("ADODB.Connection");
var cmd = new ActiveXObject("ADODB.Command");//必须注册组件scrrun.dll,(msxml3.dll 或许不用)(regsvr32 scrrun.dll )
var connstr="DRIVER={SQL Server};server=127.0.0.1;database=ttldb;uid=ttl;pwd=ttldbpwd;";
conn.Open(connstr);
cmd.ActiveConnection = conn;

cmd.CommandType = adCmdText;//adovbs.inc中的adCmdText值为&H0001
cmd.CommandText= "update Tb_FlashFile set FF_Clicks=FF_Clicks+1 where FF_Id=?";

cmd.Parameters.Append(cmd.CreateParameter("@FF_Id" , adInteger, adParamInput, 4, id));

cmd.Execute();
conn.close();
}

原文件如下:

opus.aspx

<%@ Page Language="C#" AutoEventWireup="true" Inherits="opus" CodeFile="opus.aspx.cs" %>

<%@ Register TagPrefix="cc1" Namespace="LtpPageControl" Assembly="LtpPageControl" %>



无标题

<%-- --%>




<%--






--%>



<%--DisplaySWF.aspx?id=<%#Eval("FF_Id") %>--%>

" οnclick="IncreaseClicks(<%#Eval("FF_Id")%)" target="_blank">
">


" οnclick="IncreaseClicks(<%#Eval("FF_Id")%)"
target="_blank">
<%#Eval("FF_Description")%>







Height="402px" Page_Background="images/bg_38.jpg" Tagp_Background="images/bg_38.jpg">





你可能感兴趣的:(asp.net环境下的链接点击计数--方案2)