用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。请各位帮忙找找原因,谢谢了!!!