edge-sql icon indicating copy to clipboard operation
edge-sql copied to clipboard

How to format the string request in order to execute a stored procedure that requires parameters

Open jmorrisIII opened this issue 9 years ago • 1 comments

If I change the stored procedure to not use parameters and just send exec sp_III_UpdateOperMgr it executes properly.Otherwise if it requires parameters I get an error**"Could not find stored procedure 'sp_III_UpdateOperMgr @quoteNumber,@poNumber'."**

Below is the javascript.

var updateOpMgrSql  = edge.func('sql',{
    connectionString: GM_CONNECTION_STRING,
    source:function () {
        /*
         exec sp_III_UpdateOperMgr  @quoteNumber,@poNumber
         */
    },
});

jmorrisIII avatar Dec 18 '15 14:12 jmorrisIII

You can do something like the following.

function updateOpMgrSql (req, res, next) {
    var quoteNumber = +req.params.quoteNumber;
    var poNumber = +req.params.poNumber;
    var openFunc = edge.func('sql', function() {
        /*
               EXEC sp_III_UpdateOperMgr
            */
    });
    openFunc({
        quoteNumber : quoteNumber ,
        poNumber : poNumber 
    }, function(error, result) {
        var query = req.query;
        if (error) {
            res.status(500).send(error);
        }
        res.status(200).send(result);
    });
}

Siafu avatar Jan 16 '16 04:01 Siafu

Full documentation with examples: https://github.com/agracio/edge-sql

agracio avatar Apr 23 '24 15:04 agracio