I have a SQL Server stored procedure to create a new user which I call from my Nodejs code. All works fine and the record is created but I want to be able to check if it really was inserted and was hoping to use the rowsAffected but that always comes back as [] the result from my insert is
{
"recordsets": [],
"output": {},
"rowsAffected": [],
"returnValue": 0
}
If I call the procedure from SQL Server Management Studio, I get the affected rows of 1. So am I missing something?
Here is code of how I call the stored procedure:
let storedProcedure = async (params, storedProcedureName) => {
const pool = await getOrCreatePool()
let request = await pool.request()
params.forEach((parameter) => {
parameterDirection = parameter.isOutput ? 'output' : 'input';
request = request[parameterDirection](parameter.name, parameter.type, parameter.value)
});
try {
return await request.execute(storedProcedureName)
} catch(err) {
console.error('StoredProcedure error', err);
return null;
}
}