I'm a complete beginner, I have a function 'func' that extract values from sql server, I want to return a promise containing these values when the request complete event is fired, not sure how to accomplish this. Thank you.
function func() {
const request = new Request('SQL_Procedure');
request.on('row', (columns) => {
nums.push(columns[3].value);
})
request.on('requestCompleted', () => {
return new Promise((resolve) => { resolve(nums) })//I want to return nums to the code calling the func() main function.
});
}