Skip to content

Instantly share code, notes, and snippets.

@sdejean28
Created October 4, 2019 10:02
Show Gist options
  • Save sdejean28/1ffa17cc078257313de0f7cd6602e80a to your computer and use it in GitHub Desktop.
Save sdejean28/1ffa17cc078257313de0f7cd6602e80a to your computer and use it in GitHub Desktop.
const { sql, getPool } = require(“./mssql.js”);
var notifier = require(‘./notifier.js’)
notifier.on(‘mssql_connected’, () => {
notifier.emit(‘start_process’);
})
notifier.on(‘mssql_connect_error’, () => {
console.log(‘Impossible to connect to mssql !’);
})
/************************************************/
notifier.on(‘start_process’, () => {
getPool().request()
.query(‘select count(*) from [test].[dbo].[TABLE]’, function(err, data) {
if(err)
{ console.log(‘query error >’,err);
throw err;
}
else {
console.log(‘query ok >’,data.recordset);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment