Good afternoon, I'm venturing into nodejs and I'm having some fun and I'm having a hard time getting the return of an sql query. I found some examples on the internet and they even work (the result stays on the console), and it's not what I expected ... I would like to get as a list or something else, how can I do that?
Note: I'm not aware of javascript
code:
var sql = require("mssql");
function queryinfo (info) {
// Create connection instance
var conn = new sql.ConnectionPool(dbConfig);
conn.connect()
// Successfull connection
.then(function () {
// Create request instance, passing in connection instance
var req = new sql.Request(conn);
var content = {};
// Call mssql's query method passing in params
req.query("SELECT info, consulta FROM dbo.infoconsulta WHERE info=\'" + info + "\'")
.then(function (recordset) {
return recordset;
})
// Handle sql statement execution errors
.catch(function (err) {
console.log(err);
conn.close();
})
})
}