注册 登录
编程论坛 新人交流区

Javascript连接Access数据库的问题

pandy420 发布于 2007-10-28 16:11, 347 次点击

用google搜索“javascript连接access”,等到一个例子,我按照例子执行,却一点反应也没有,请各位看看。谢谢了!!
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--

function getCountFromDB() {
document.write("Begin to run getCountFromDB function.");
var filePath = location.href.substring(0, location.href.indexOf("Cnt.htm"));
var path = filePath + "MyData.mdb";
path = path.substring(8);

var con = new ActiveXObject("ADODB.Connection");
con.Provider = "Microsoft.Jet.OLEDB.4.0";
con.ConnectionString = "Data Source=" + path;

con.open;
document.write("The db is opened.");
con.close();
con = null;
document.write("The db is closed.");
}
-->
</SCRIPT>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!--

getCountFromDB();

-->
</SCRIPT>
</BODY>
</HTML>

我在浏览器中输入http://localhost/Cnt.htm,可是只显示“Begin to run getCountFromDB function.”,open和close都不显示,表示没有执行open和close。请各位帮忙找找原因,谢谢了!!!

5 回复
#2
lilin4444mol2007-10-28 16:18
不懂
#3
pandy4202007-10-28 17:26
就是下面这些语句都没有执行,不知道什么原因?
con.open;
document.write("The db is opened.");
con.close();
con = null;
document.write("The db is closed.");
#4
pandy4202007-10-28 17:39
相信新人区里也有高手。
#5
helagu2007-10-28 19:36
不懂
#6
pandy4202007-10-28 20:06
有人懂么
1