Menu
  • HOME
  • TAGS

How to access the output parameter in node mssql?

javascript,node.js,node-mssql

request.parameters.pqr.value and request.parameters.def.value Got the answer , so sharing it :)...

How can I use a single mssql connection pool across several routes in an Express 4 web application?

sql-server,node.js,express,node-mssql

I actually asked the question to answer it myself, because I believe I had an answer that was worth to share and I couldn't find a documented solution elsewhere. Also in a few issues (#118, #164, #165) at node-mssql this topic is discussed. Here's my solution: In server.js var express...

encoding and save images

node.js,image-processing,node-mssql

Use input parameters, it's almost always a bad idea to concatenate values into TSQL. var request = new sql.Request(connection); request.input('id', rows[i].id); request.input('budova', rows[i].budova); request.input('patro', rows[i].patro); request.input('mapa', sql.VarBinary(MAX), images(rows[i].mapa).toBuffer('jpg', {quality: 50})); request.query('INSERT INTO dbo.cis_mapyNewBudov (id, budova, patro, mapa) VALUES (@id, @budova, @patro, @mapa)', function (err) { // ... }); Hint: Always...

How do I render return values of a node-mssql statement with Jade?

javascript,node.js,express,jade,node-mssql

You will have the res.render in the callback from query. function runSQLSelect(callback) { sql.connect(config.db, function(err) { var request = new sql.Request(); request.query("select MyColumn FROM MyTable", function(err, recordset) { console.log(recordset); callback(recordset); }); }); } function home(req, res) { runQSQLSelect( function(result) { res.render("site/index", {recordset: result}); //render the Jade template }); } Note,...

Connect to localdb with sql-cli

sql-server,command-line-interface,node-mssql

its because (localdb)\v11.0 is not an actual instance as it can only be used inside visual studio. "The localdb is at the heart of SSDT; it’s similar to SQL Server Express under the hood and runs a full version of sqlserver.exe. However this is throttled by the numbers of CPUs...

Node.js npm mssql function returning undefined

javascript,node.js,callback,node-mssql

You are trying to treat the sqlCall as a synchronous function with a return value, while the request.query function on the opposite is an asynchronous function, expecting a callback. Since Node.js uses non blocking IO and callback structures for flow control, using an asynchronous structure based around callbacks is the...