熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

用JavaScript操作數據庫

2013-11-15 11:45:19  來源: JSP教程 

  <script language=javascript runat=server>
  //用 JavaScript 寫服務器端連接數據庫的代碼示例
  var conn = new ActiveXObject(ADODBConnection);
  connOpen(Provider=SQLOLEDB; Data Source=localhost; User ID=sa;
    +Password=password; Initial Catalog=meizz);

  var rs = new ActiveXObject(ADODBRecordset);
  var sql=select user_kind from tbRightSet where user_id=+ Account +;

  rsopen(sql conn);
  if (!rsEOF)
  {
    sysUserKind = (rs(user_kind)+)replace(/^\s+|\s+$/ );
  }
  rsclose(); rs = null; connclose(); conn = null;
</script>


From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19562.html
  • 上一篇文章:

  • 下一篇文章:
  • 推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.