用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>
-= 资 源 教 程 =-
文 章 搜 索