JavaScript Access代码参考
///下面是对Access的链接
function getCountfromDB() {
//以当前页面文件为基础,找到文件所在的绝对路径。
var filePath = location.href.substring(0, location.href.indexOf("Cnt.htm"));
var path = filePath + "MyData.mdb";
//去掉字符串中最前面的"files://"这8个字符。
path = path.substring(8);
var updateCnt = 0;
//生成查询和更新用的sql语句。
var sqlSelCnt = "SELECT COUNT from [COUNT] WHERE ID = 'count'";
var sqlUpdCnt = "UPDATE [COUNT] SET [COUNT] = '";
//建立连接,并生成相关字符串
var con = new ActiveXObject("ADODB.Connection");
con.Provider = "Microsoft.Jet.OLEDB.4.0";
con.ConnectionString = "Data Source=" + path;
con.open;
//rs记录表的建立
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;
&
相关文档:
本文译自:http://www.codeproject.com/KB/scripting/jsbeginner.aspx
原文:JavaScript For Beginners
适宜对象:JavaScript初学者。
目录:
包含与引入(Embedding,including)
write 和 writeln
文档对象(document object)
bgColor 和 fgColor
消息框(Message Box)
变量(Variables ......
在JavaScript中字符串组合相加,大家一般直接用+拼接起来.例如:
for(i=0; i<len; i++){
if(zdname != ""){
zdname += "#" + trNode.children.item(i).getAttribute("busPath");
}else{
zdname = trNode.children.item(i).getAttribute("busPath");
  ......
ruby常规访问access数据库的方法应该是使用DBI库
:
require 'dbi'
DBI.connect("DBI:ADO:Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db.mdb;")
可是
简单尝试之后没能成功,提示找不到驱动器ADO,懒得再试,遂找其他方法。
一番搜索之后,发现可以用WIN32OLE来访问access,写一个简单的类包装之:
......
JavaScript 有六种数据类型。主要的类型有 number、string、object 以及 Boolean 类型,其他两种类型为 null 和 undefined。
String 字符串类型:字符串是用单引号或双引号来说明的。(使用单引号来输入包含引号的字符串。)如:“The cow jumped over the moon.”
数值数据类型:JavaScript 支持整数和浮点 ......
JavaScript 有六种数据类型。主要的类型有 number、string、object 以及 Boolean 类型,其他两种类型为 null 和 undefined。
String 字符串类型:字符串是用单引号或双引号来说明的。(使用单引号来输入包含引号的字符串。)如:“The cow jumped over the moon.”
数值数据类型:JavaScript 支持整数和浮点 ......