How to get the row count from an azure database?

后端 未结 3 1107
暖寄归人
暖寄归人 2021-01-18 20:42

Am working on a windows store javascript application. The application uses data from azure mobile services. Consider the below code:



        
3条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-18 21:03

    You need to execute read() on the table query and then get the length of the results.

    var items, numItems;
    itemTable.read().then(function(results) { items = results; numItems = items.length; });
    

    If you are only showing a record count and not the entire results - you should just select the ID column to reduce the amount of data transmitted. I don't see a count() method available yet in the JS Query API to fill this need.

    var itemTable = mobileService.getTable('item').select('itemID');
    

提交回复
热议问题