dcsimg
www.webdeveloper.com
Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18

Thread: Reading/Writing data in MS-Access database using javascript

  1. #16
    Join Date
    May 2014
    Posts
    2
    Quote Originally Posted by gary90 View Post
    hi ,,

    thanks but i cant get all data rows from my db ,.,please help me thanks in advance
    This work for me here:

    function query(){
    var pad = "C:\\Users\\XXXXXX\\Documents\\DATABASENAME.accdb";
    var cn = new ActiveXObject("ADODB.Connection");
    var strConn = "Provider=microsoft.ace.oledb.12.0;Data Source=" + pad;
    cn.Open(strConn);
    var rs = new ActiveXObject("ADODB.Recordset");
    var SQL = "SELECT * FROM tblName";
    var i = 100;
    rs.Open(SQL, cn);
    if(!rs.bof) {
    rs.MoveFirst();
    while(!rs.eof) {
    document.write();
    document.write("<p>" + rs.fields(1).value + " ");
    document.write(rs.fields(2).value + " ");
    document.write(rs.fields(3).value + " ");
    document.write(rs.fields(4).value + ".</p>");
    rs.MoveNext();
    }
    }
    else {
    document.write("No data found");
    };
    rs.Close();
    cn.Close();
    }

  2. #17
    Join Date
    Jan 2016
    Posts
    1
    Quote Originally Posted by Flippervan65 View Post
    This code does the trick:
    <script type="text/javascript">
    var pad = "D:\\Flipper\\Documenten\\data.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 datatable";
    rs.Open(SQL, cn);
    if(!rs.bof) {
    rs.MoveFirst();
    if(!rs.eof) {
    document.write("<p>" + rs.fields(1).value + ", ");
    document.write(rs.fields(2).value + ", ");
    document.write(rs.fields(3).value + ".</p>");
    }
    }
    else {
    document.write("No data found");
    };
    rs.Close();
    cn.Close();
    </script>

    It only works with InternetExplorer or in Firefox with the IEtab set to Internet Explorer.
    How can we get spesific field value via textbox for this one?

  3. #18
    Join Date
    May 2016
    Posts
    4
    Wow!!

    I have been looking for code like this literally for *many* *months*(!!!)

    Now to get it to work with a database sitting on the server. How can I accomplish that?

    Thanks.

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles