主题:  嘿,帮个忙看看怎么改这段代码:)谢谢

7877767

职务:普通成员
等级:2
金币:1.0
发贴:528
注册:2002/2/19 0:11:31
#12002/5/12 18:24:52
我找了个计数器,是使用文本记录数据的,我的免费空间不支持对文本的存取,请问各位怎么把它改写成把数据记录在一个名字为counter.mdb的数据库的count表格的countpage字段里面?先谢谢了!代码如下:

<%@ LANGUAGE = VBScript %>
<%option explicit %>
<% response.buffer=true %>
<%

dim fs,a,readline
Session.Timeout=1
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.OpenTextFile(Server.Mappath("count.txt"))
readline = Clng(a.ReadLine)
if Session("readline") = "" then
Session("readline") = readline
readline = readline + 1
a.close
Set a = fs.CreateTextFile(Server.Mappath("count.txt"), True)
a.WriteLine(readline)
end if
a.Close

%>

<%

dim length,i,imgPath
imgPath=""
Length = Len(readline)
for i=1 to 6-Length
imgPath = imgPath & ""
next

for i=1 to Length
imgPath= imgPath & ""
next

Response.ContentType = "application/x-javascript"
'Response.Write ""

%>
TextText



5D荣誉斑竹

职务:普通成员
等级:3
金币:10.0
发贴:1480
注册:2002/1/15 11:01:54
#22002/5/13 9:49:46
用这个改不等于重写了吗?
自己再写个更新数据的页面就是了.
INCLUDE在页面头部,
每次登陆加一不就好了.



5D荣誉版主

职务:普通成员
等级:2
金币:10.0
发贴:658
注册:2000/11/13 10:22:37
#32002/5/13 14:12:28
<%@ LANGUAGE = VBScript %>
'counter.mdb的数据库的count表格的countpage
<%
set conn=server.createobject("adodb.connection")
conn.open "provider=microsoft.jet.oledb.4.0;data source="&server.mappath("counter.mdb")
sql="update count set countpage=countpage+1"
conn.execute(sql)
%>



7877767

职务:普通成员
等级:2
金币:1.0
发贴:528
注册:2002/2/19 0:11:31
#42002/5/14 21:11:54
那就重写一个吧,可是该怎么写 呢?哪里有详细一点的教程?我现在还只会在UD里做点简单的东西哩:(