【发布时间】:2018-11-09 03:26:59
【问题描述】:
我正在尝试了解如何修复我的代码,因为我的函数返回未定义。我正在使用 Sequelize 和 NodeJS 编写代码。
exports.getCreditsStudent = function(sgecode,collections,grade,year){
mssql.query('SELECT total FROM [dbo].[creditosAvulsos] WHERE codsge = $sgecode1 and nivelensino_idnivelensino = $collections1 and produto_idproduto = $grade1 and ano = $year1',
{ bind:{sgecode1: sgecode, collections1: collections, grade1: grade, year1: year}, type: mssql.QueryTypes.SELECT})
.then(total => {
return total
})
}
我在我的 Service.js 上调用这个函数,像这样:
examples = db.getCreditsStudent(sgecode,collections,grade,year);
问题出在哪里以及如何解决?
谢谢。
【问题讨论】:
标签: node.js sql-server sequelize.js