node.js with SQL Server Native Client 11 scope_identity not being returned
Posted
by
binderbound
on Stack Overflow
See other posts from Stack Overflow
or by binderbound
Published on 2013-11-06T03:50:51Z
Indexed on
2013/11/06
3:53 UTC
Read the original article
Hit count: 277
I'm having trouble with inserting a value into a database through node.js. Here is the offending code:
sql.query(conn_str
,"INSERT INTO Login(email, hash, salt, firstName, lastName) VALUES(?, ?, ?, ?, ?);
SELECT SCOPE_IDENTITY() AS 'Identity';"
, [email, hash, salt, firstName, lastName], function(err, results){
console.log(results)
}
Unfortunately, the console is just echoing []
, meaning results is an empty array, I suppose.
Does anyone know why the identity is not being returned? Even if it was null, why isn't results then [{Identity: null }]
?
Database is on Azure, which does have a "Scope_Identity" function, and the native client also recognises this function.
Using node package "msnodesql"
Please Help
© Stack Overflow or respective owner