当前位置:编程学习 > 网站相关 >>

html操作本地数据库

 
来源:vbs小铺

<script language="javascript">
  //用 JavaScript 写服务器端连接数据库的代码示例
  var conn = new ActiveXObject("ADODB.Connection");
  conn.Open("DBQ=c:\a.mdb;DRIVER={Microsoft Access Driver (*.mdb)};");
  var rs = new ActiveXObject("ADODB.Recordset");
  var sql="select * from friends_infor";
  rs.open(sql, conn);
 shtml = "<table width=100% border=1>";
 shtml +="<tr bgcolor=#f4f4f4><td>au_id</td><td>au_lname</td><td>au_fname</td></tr>";
  while(!rs.EOF)
  {
 shtml += "<tr><td>" + rs("friend_id") + "</td><td>" + rs("friend_name") + "</td><td>" + rs("friend_nickname") + "</td></tr>";
 rs.moveNext;
  }
  shtml += "</table>";
  document.write(shtml);
  rs.close();
  rs = null;
  conn.close();
  conn = null;
 </script>

补充:综合编程 , 安全编程 ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,