var updateCnt = 0;
//生成查询和更新用的sql语句。
var sqlSelCnt = "Select COUNT FROM [COUNT] Where ID = 'count'";
var sqlUpdCnt = "Update [COUNT] SET [COUNT] = '";
//建立连接,并生成相关字符串 www.knowsky.com。
var con = new ActiveXObject("ADODB.Connection");
con.Provider = "Microsoft.Jet.OLEDB.4.0";
con.ConnectionString = "Data Source=" + path;
con.open;
var rs = new ActiveXObject("ADODB.Recordset");
rs.open(sqlSelCnt, con);
while (!rs.eof) {
var cnt = rs.Fields("COUNT");
document.write(cnt);
//将取得结果加1后更新数据库。
updateCnt = cnt * 1 + 1;
rs.moveNext;
}
rs.close();
rs = null;
sqlUpdCnt = sqlUpdCnt + updateCnt + "'";
con.execute(sqlUpdCnt);
con.close();
con = null;
}
function getCountFromTxt() {
var filePath = location.href.substring(0, location.href.indexOf("Cnt.htm"));
var path = filePath + "count.txt";
path = path.substring(8);
var nextCnt = 0;
var fso, f1, ts, s;
//以只读方式打开文本文件。
var ForReading = 1;
//以读写方式打开文本文件。
var ForWriting = 2;
fso = new ActiveXObject("Scripting.FileSystemObject");
f1 = fso.GetFile(path);
ts = f1.OpenAsTextStream(ForReading, true);
s = ts.ReadLine();










