用JavaScript操作数据库

发表于:2007-06-21来源:作者:点击数: 标签:
script language=" java script" runat="server" //用 Java Script 写 服务器 端连接 数据库 的代码示例 var conn = new ActiveXObject("ADODB.Connection"); conn.Open("Provider= SQL OLEDB.1; Data Source=localhost; User ID=sa; " +"Password=password;

   

<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='"+ Aclearcase/" target="_blank" >ccount +"'";


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

原文转自:http://www.ltesting.net