daily pastebin goal
52%
SHARE
TWEET

Untitled

a guest Dec 29th, 2016 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. "get": function (req, res, next) {
  2.      var sql = require("mssql");
  3.  
  4. var config = {
  5.     server: 'LOCALHOST\SQLEXPRESS',
  6.     user: 'sa',
  7.     password: 'pass1009',      
  8.     database: 'smartpointmovil_db',
  9.     port: 1433
  10. };
  11.  
  12.  
  13. var conn = new sql.Connection(config);
  14. var req=new sql.Request(conn);
  15.  
  16.   conn.connect(function(err){
  17.       if(err){
  18.            console.log("Error connectig: "+err);
  19.            return;
  20.       }
  21.  
  22.  
  23.       req.query('select * from smartpointmovil.cat_cadenas where id=1',function(err,results){
  24.                     if(err){
  25.                            console.log("Error during query: "+err);
  26.                            return;
  27.                            }
  28.                     else{
  29.                           console.log("Success: "+results[0].cadena);
  30.                           res.json(results[0]);
  31.                          }
  32.                     conn.close();
  33.       });
  34.  
  35.   });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top