1

我正在使用 node-mssql ( https://github.com/patriksimek/node-mssql ) 节点模块来连接我的 SQL Server。

我有一些要求,比如

declare @isTrue int
exec @isTrue = sp_isFolderExist @name='new folder',@FolderTypeID=1
select @isTrue

如何执行这个存储过程并获取isTrue变量的值?

4

1 回答 1

0
var sql = require('mssql');

sql.connect("mssql://username:password@localhost/database", function(err) {
    // ... error checks

    new sql.Request()
    .input('name', 'new folder')
    .input('FilterTypeID', 1)
    .execute('sp_isFolderExist', function(err, recordsets, returnValue) {
        // ... error checks

        console.log(returnValue); // your isTrue value
    });
});
于 2016-05-11T22:52:46.120 回答