用JavaScript操作数据库

时间:2010-04-20 17:41:01  来源:第二电脑网  作者:第二电脑网

  第二电脑网导读:er=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...
  正文:

<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>


"用JavaScript操作数据库"由第二电脑网原创提供,转载请注明:http://www.002pc.com/master/College/Programming/JavaScript/13722.html


关键字:

关于《用JavaScript操作数据库》文章的评论

站内搜索: 高级搜索

热门搜索: Windows style 系统 tr IP QQ CPU 安装 function 注册 if td