<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