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
HTMLChromeJavaScriptMicrosoft AccessWeb Browsers

Avatar of undefined
Last Comment
xenium

8/22/2022 - Mon
SOLUTION
Rob

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Ryan Chong

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Dave Baldwin

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
xenium

ASKER
Thanks all for your quick answers.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck