I'm trying to use the transaction class from the mssql package of nodejs. So as i read on http://www.dotnetcurry.com/nodejs/1238/connect-sql-server-nodejs-mssql-package, i did the following :
Db.prototype.transaction = function() {
return new Promise((resolve, reject) => {
pool.connect().then(conn => {
let transaction = new mssql.Transaction(conn).begin().then(() => {
new mssql.Request(transaction).query("SELECT * FROM ParkingSlot").then(() => {
transaction.commit().then((recordset) => {
conn.close();
resolve(recordset);
}).catch(reject)
}).catch(reject);
}).catch(reject)
});
});
};
On the caller function, i did db.transaction().then(console.dir); to output any result one console. But nothing happen.
via Little squirrel
No comments:
Post a Comment