0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script language="text/JavaScript">
function Myconn(){  

var cn = new ActiveXObject("ADODB.Connection");
            var strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = Test.mdb;Persist Security Info=False";
            cn.Open(strConn);
            var rs = new ActiveXObject("ADODB.Recordset");
            var SQL = "select * from Customers";
        rs.Open(SQL, cn);

            while(rs.EOF == false)
            {
    document.Write(rs.Fields(0));[COLOR="Red"]/* This gives an error as Object not defined*/ [/COLOR]
            rs.MoveNext();
            }

            rs.Close();
            cn.Close();              
}

</script>

</head>

<body>
<input type="button" name="Sub" value="display" onclick="Myconn()"/>
/* error shows up here*/
</body>
</html>

Edited by Dani: Formatting fixed

1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by shyam87
0

the above code works when using alert(rs(0)); instead of document.Write();
i need to know how to display the data that is stored in the recordset..

p.s i cant use ASP as the system has the port 80 disabled by the admin..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.