JS connection SQL database and ACCESS database method instances


//Connect the SQL
<script language="javascript">
   var conn = new ActiveXObject("ADODB.Connection");
  conn.Open("Provider=SQLOLEDB.1; Data Source=tgf; User ID=sa; "
  +"Password=sasa; Initial Catalog=MyBulletin");
  var rs = new ActiveXObject("ADODB.Recordset");
  var sql="select id,name from Category";
  rs.open(sql, conn);
  alert(rs(0));//Take the first one out
  rs.close(); 
  rs = null;
  conn.close(); 
  conn = null;
</script>
//Connect the ACCESS
<script language="javascript">
    function conn(){
  var db_bbs
  db_bbs="dd.mdb"//Define database
  var conn = new ActiveXObject("ADODB.Connection");
conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+db_bbs+"");

var rs = new ActiveXObject("ADODB.Recordset");
  var sql="select name from authors"; //We have the authors table in the database, the name field
rs.open(sql,conn);
  alert(rs(0))//Take the first one out
conn.close(); 
  conn = null;
}
</script>