【问题标题】:NodeJS - Sequelize - Stored Procedure - is not workingNodeJS - Sequelize - 存储过程 - 不工作
【发布时间】:2019-04-16 13:05:17
【问题描述】:

我正在尝试找出下面我的代码有什么问题,我正在使用插件 Tedious (SQL Server)、sequelize 和 NodeJs:

exports.getCreditsGeneral = function(sgecode) {
    return sequelize.query('[dbo].[SP_ListaCreditos](:sgecode1)',
          { replacements:{sgecode1: sgecode}})
          .then(total => {        
               return total.length ? total : 0
          })
} 

有人可以帮帮我吗?

谢谢。

【问题讨论】:

    标签: node.js sql-server sequelize.js


    【解决方案1】:

    你缺少 exec 参数

    exports.getCreditsGeneral = function(sgecode) {
        return sequelize.query('exec [dbo].[SP_ListaCreditos](:sgecode1)',
              { replacements:{sgecode1: sgecode}})
              .then(total => {        
                   return total.length ? total : 0
              })
    } 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-13
      • 2014-09-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-22
      相关资源
      最近更新 更多