sql server - Azure Easy API JavaScript: How to return multiple result set from MSSQL query -


i have created azure easy api (on app service migrated mobile service). want return 3 result sets sql stored procedure. returns first result set. have read setting multiple attribute of query true allow returning multiple result sets, not sure how it. that's azure api looks like:

exports.get = function(request, response) {      var mssql = request.service.mssql;     var param1 = request.query.pollid;     var param2 = request.query.userid;     var sql = "exec poll.getpollsdata @pollid = ?, @userid = ?";      mssql.query(sql, [param1, param2], {         success: function(results) {                   response.send(200, results);              }, error: function(err) {                 response.send(400, { error: err });                 }     }); }; 

getpollsdata stored procedure returns 3 result sets (for polls, questions , options). api shows first table on client side (in polldata below).

this client side javascript:

client = new windowsazure.mobileserviceclient(a, k); client.invokeapi('getpollsdata', {     method: 'get',     parameters: {         pollid: p,         userid: u,     } }).done(function(results) {     polldata = json.parse(results.response); }, function(error) {     console.log(error); }); 

please try use execute() function in azure mobile apps in node.js, , add parameter multiple true described @ http://azure.github.io/azure-mobile-apps-node/jsdoc_data.execute.js.html#line55.

e.g.

module.exports = {     "get": function (req, res, next) {         var query = {             sql:'exec [dbo].[sampleprocedure]',             multiple:true         };         req.azuremobile.data.execute(query).then(function(results){             console.log('results',results);             res.json(results);         })     } } 

it return array contains multiple result arrays.

any further concern, please feel free let me know.


Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -