var config = {
user: ‘sa‘,
password: ‘123456‘,
server: ‘127.0.0.1‘, // You can use ‘localhost\\instance‘ to connect to named instance
database: ‘mydb‘,
options: {
encrypt: true // Use this if you‘re on Windows Azure
},
pool: {
max: 10,
min: 0,
idleTimeoutMillis: 30000
}
}
sql.connect(config, function(err) {
var request = new sql.Request();
request.input(‘input_parameter‘, sql.Int, value); //输入参数
request.output(‘output_parameter‘, sql.Int); //输出参数
request.execute(‘PROC_TEST‘, function(err, recordsets, returnValue) {
console.dir(recordsets);
console.log(returnValue); // procedure return value
console.log(request.parameters.output_parameter.value); // output value
});
});