学了mssql 感觉都会mysql了,我只有mysql教程,以mysql为基础学习mssql
先看下效果图:分页还在研究中
js代码:
router.get("/departlist",function (erq,res,next) {
sql.connect(db).then(function () {
sql.query("select * from SYS_Academe",function (err,data) {
if (err){
console.log(err);
} else {
res.render("department_list",{departmentList:data.recordset})
sql.close()
}
})
})
})
页面代码:
<table cellpadding="0" border="0" cellspacing="0" class="user clear">
<tr class="first">
<td width="5%"></td>
<td width="8%">机构名称</td>
<td width="10%">机构编码</td>
</tr>
<%for(var i = 0; i < departmentList.length; i++){%>
<%if(i%2 == 0){%>
<tr >
<td><input type="checkbox" class="checkbox" title="" /></td>
<td width="5%"><%=departmentList[i]["AcademeCode"] %></td>
<td width="5%"><%=departmentList[i]["AcademeName"] %></td>
</tr>
<%}else{%>
<tr class="double">
<td><input type="checkbox" class="checkbox" title="" /></td>
<td width="5%"><%=departmentList[i]["AcademeCode"] %></td>
<td width="5%"><%=departmentList[i]["AcademeName"] %></td>
</tr>
<%}%>
<%}%>
</table>
分页还在研究中