So this is my basic chunk of code that I'm running. I've got RowCount coming back as expected (there's only 5 items right now) and but rows comes back as an empty array.
Am I doing something wrong? By the way I'm connecting to SQL azure. I don't have any connection problems and I do believe that I've put the correct options (rowCollectionOnRequestCompletion to true).
Any ideas?
var Connection = require('tedious').Connection;
var Request = require('tedious').Request;
exports.list = function(req, res){
var connection = new Connection({
"userName": "myCoolUsername",
"password": "SoMePa$$word",
"server": "something.database.windows.net",
"options": {
"database": "mySampleDbName",
"encrypt": true,
"rowCollectionOnDone": true,
"rowCollectionOnRequestCompletion": true
}
});
connection.on('connect', function(err){
//if no error, then we are good to go.
if(err){
console.log(err);
}else
{
var request = new Request("SELECT * FROM Products", function(err, rowCount, rows){
console.log(rowCount);
res.send(rows);
})
connection.execSql(request);
}
});