title: Typescript return SQL Server connection variable
body: <p>I am using a method to return SQL Server connection variable.</p>
  
  <pre><code>const sql = require('mssql');
  
  /* sql configuration */
  var config = {
      user: '***',
      password: '***',
      server: '***',
      database: '***',
      port: '***',
      multipleStatements: true,
      timezone: '+00:00'
  };
  
   function getRequest(){
      return new Promise(function(resolve, reject) {    
          sql.close()    
          sql.connect(config, function (err:any) {            
                  if (err) reject(err); 
              var sqlrequest = new sql.Request();  
              //console.log(sqlrequest);          
              resolve(sqlrequest);    
          });       
      });
  }
  </code></pre>
  
  <p>I am calling the connection by below code. but this is not working, the process is not hitting section one. Could any one help me thank you. </p>
  
  <pre><code>getRequest().then(function(sqlrequest:any) {
     //not hitting into this section --section 1 
     sqlrequest.input('ReturnValue',0);
     sqlrequest.output('ReturnValue',sql.Int);
     sqlrequest.execute('SaveHl7File')
  .then(function(recordsets:any, err:any) {
    console.log([recordsets0);
  }
  </code></pre>