Using MSSQL module, I've been trying to view the create two functions, primarily one to read the data off the database table and make it into a variable. The other will write data from an get request and update the database table.
I have the following for reading the data but I do not get any response once logged in, unsure what I'm doing wrong.
let id = {};
let date = {};
let response = {};
let readLoggerData = function(err) {
if (err) throw err;
con.query('SELECT * FROM Logging ORDER BY Date DESC;'),
function(id, response, date) {
if (response) {
id = request.query('SELECT TOP 1 id from Logging;');
date = request.query('SELECT TOP 1 Date FROM Logging;');
response = request.query('SELECT TOP 1 Response from Logging;');
};
};
};
console.log(id);
});