Link to home
Start Free TrialLog in
Avatar of xenium
xenium

asked on

Local HTML file to display local Access MDB data in browser

hi,

I came across the following code which works perfectly in IExplorer. Is there a way to make it work in Chrome or Edge? For a javascript total newbie.

<html>

<title>test javascript to read ms access data</title>

<script type="text/javascript">
//http://www.webdeveloper.com/forum/showthread.php?1957-Reading-Writing-data-in-MS-Access-database-using-javascript
var pad = "C:\\Alex\\test.mdb";
var cn = new ActiveXObject("ADODB.Connection");
var strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + pad;
cn.Open(strConn);
var rs = new ActiveXObject("ADODB.Recordset");
var SQL = "SELECT * FROM Org";
rs.Open(SQL, cn);
if(!rs.bof) {
rs.MoveFirst();
if(!rs.eof) {
document.write("<p>" + rs.fields(0).value + ", ");
document.write(rs.fields(2).value + ".</p>");
}
}
else {
document.write("No data found");
};
rs.Close();
cn.Close();
</script>

</html>

Open in new window


thanks
SOLUTION
Avatar of Rob
Rob
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of xenium
xenium

ASKER

Thanks all for your quick answers.