We help IT Professionals succeed at work.
Get Started

Local HTML file to display local Access MDB data in browser

1,165 Views
Last Modified: 2017-03-23
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
Comment
Watch Question
CERTIFIED EXPERT
Distinguished Expert 2020
Commented:
This problem has been solved!
Unlock 3 Answers and 4 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE