使用mssql时,评论系统出错的问题,这个问题是我老早就解决了,一直没贴解决办法。原因是sql系统的一个问题,这个只有使用mssql数据库的有(使用access的是没有问题的,请不要使用下面的代码)。
解决办法:
找到\page\comment目录下的fun.asp,在253行,可以搜索“public sub log(l1)'评论日志”找到,把这个函数替换为下面的这个就行了。
public sub log(l1)'评论日志
if len(l1)>0 then
conn.execute("set IDENTITY_INSERT kingcomment_log on"
if conn.execute("select count(*) from kingcomment_log where ip="&kc.ip&";"(0)>0 then
conn.execute "update kingcomment_log set kcontent='"&safe(left(l1,50))&"',kdate='"&tnow&"' where ip="&kc.ip&";"
else
conn.execute "insert into kingcomment_log (ip,kcontent,kdate) values ("&kc.ip&",'"&safe(left(l1,50))&"','"&tnow&"')"
end if
else
if conn.execute("select count(*) from kingcomment_log where ip="&kc.ip&";"(0)>0 then
conn.execute "update kingcomment_log set kdate='"&tnow&"' where ip="&kc.ip&";"
else
conn.execute "insert into kingcomment_log (ip,kdate) values ("&kc.ip&",'"&tnow&"')"
end if
conn.execute("set IDENTITY_INSERT kingcomment_log off"
end if
end sub
需要说明的是如果使用了Digg那么也会有同样的问题,只是表名不一样 评论的是kingcomment_log Digg的是Kingdigg_log,代码也在差不多的位置,
' *** Copyright © KingCMS.com All Rights Reserved ***
public sub log()
conn.execute("set IDENTITY_INSERT kingdigg_log on")
if conn.execute("select count(*) from kingdigg_log where ip="&kc.ip&";")(0)>0 then
conn.execute "update kingdigg_log set kdate='"&tnow&"' where ip="&kc.ip&";"
else
conn.execute "insert into kingdigg_log (ip,kdate) values ("&kc.ip&",'"&tnow&"')"
end if
conn.execute("set IDENTITY_INSERT kingdigg_log off")
end sub