Sql Server to call node.js function -
i'm using sql server , have function in node.js want executed everytime new row inserted in specific table.
this code want run when change made in table.
private sql = require('mssql'); private currentid: any; private config = { user: 'sa', password: 'sa', server: '192.168.100.2', port: '1433', database: 'test1', connectiontimeout: 100000,}; public checkdatabase() { this.sql.connect(this.config).then((connection: any) => { new this.sql.request(connection).query('select eventid events order eventid desc').then((recordset: any) => { console.log(recordset.recordset[0].eventid); if (this.currentid == recordset.recordset[0].eventid) { console.log("isti se nema potreba da se pravi promena " + this.currentid + " " + recordset.recordset[0].eventid); } else { console.log("ne se istiiiiiiii " + this.currentid + " " + recordset.recordset[0].eventid); } this.currentid = recordset.recordset[0].eventid; }); }); }
any suggestions please?
Comments
Post a Comment