你是节点js api的新手
我的程序返回数据,如下所示 我不知道我犯了什么错误
它只是从mssql数据库返回表中的所有行。
记录集&记录
exports.getList = function (req, resp) {
db.executeSql("SELECT * FROM OfficeDetails", function (data,err) {
if (err) {
httpMsgs.show500(req, resp, err);
} else {
console.log("response data " + JSON.stringify(data));
httpMsgs.sendJson(req, resp, data);
}
});
};
{
"recordsets": [
[
{
"DeptName": "Software",
"DeptId": 3
},
{
"DeptName": "Sales",
"DeptId": 1
}
]
],
"recordset": [
{
"DeptName": "Software",
"DeptId": 3
},
{
"DeptName": "Sales",
"DeptId": 1
}
],
"output": {},
"rowsAffected": [
2
]
}
答案 0 :(得分:0)
exports.getList = function (req, resp) {
db.executeSql("SELECT * FROM OfficeDetails GROUP BY DeptId HAVING COUNT(DeptId )>1", function (data,err) {
if (err) {
httpMsgs.show500(req, resp, err);
} else {
console.log("response data " + JSON.stringify(data));
httpMsgs.sendJson(req, resp, data);
}
});
};