-1
I got a problem. I have the following code with the proper credentials and I can’t return the value that returns in . then(result), I need to make it return a JSON in this function with all the lines, I’ve tried everything and nothing worked Could someone help me? I’m already a good trying to hit head with this. Follows the code
@EDIT--------------------------------------------------------------------------------------------------------------------------------------- Function result in ibm cloud returns so, no errors and no lines to show..
Activation ID: .... Results: {} Logs: []
const sql = require('mssql');
function main(params) {
var results;
const config = {
user: '',
password: '',
server: '',
database: '',
options: {
"enableArithAbort": true
},
}
sql.on('error', err => {
console.log(err)
})
sql.connect(config).then(() => {
return sql.query('SELECT * FROM TABLETESTE')
}).then(result => {
results = result.recordset;
console.dir(result.recordset[0])
}).catch(err => {
console.dir(err)
})
return JSON.stringify(results); //<--
};
exports.main = main;