I got the following nodejs code snippet working. It hangs in the end and does n ot return. How to get the function getAllRecords() to return and the program to end?? In the end I want to get, insert and delete users based on the status. If the function does not return I cannot do so.
var fs = require("fs");
var sql = require("mssql");
var config = {
"server": "localhost",
"user": "xxxx",
"password": "xxxx",
"database": "dbTA",
"port": 1433
};
function getAllRecords(config) {
sql.connect(config).then(function() {
// Query
new sql.Request().query('select * from USERSTATUS').then(function(recordset) {
console.log(recordset);
}).catch(function(err) {
console.log("Error1", err);
});
}).catch(function(err) {
console.log("Error2", err);
});
}
getAllRecords(config);
via win
No comments:
Post a Comment