当前位置导航:炫浪网>>网络学院>>网页制作>>JavaScript教程

用Javascript操作数据库

<script language="javascript" runat="server">
  //用 JavaScript 写服务器端连接数据库的代码示例
  var conn = new ActiveXObject("ADODB.Connection");
  conn.Open("Provider=SQLOLEDB.1; Data Source=localhost; User ID=sa; "
    +"Password=password; Initial Catalog=meizz");

  var rs = new ActiveXObject("ADODB.Recordset");
  var sql="select user_kind from tbRightSet where user_id='"+ Account +"'";

  rs.open(sql, conn);
  if (!rs.EOF)
  {
    sysUserKind = (rs("user_kind")+"").replace(/^\s+|\s+$/, "");
  }
  rs.close(); rs = null; conn.close(); conn = null;
</script>

相关内容
赞助商链接