此设置适用于 express.js 2022、sql server 2014
var sql = require('mssql');
var config = {
user: 'your user',
password: 'your password',
server: 'your server',
database: 'your database',
"options": {
"encrypt": false,
"enableArithAbort": true,
"trustServerCertificate":false
}
};
sql.connect(config, function (err) {
if (err) console.log(err);
// create Request object
var request = new sql.Request();
// query to the database and get the records
request.query('select * from a_pinfinger', function (err, recordset) {
if (err) console.log(err)
// send records as a response
//res.send(recordset);
console.log(recordset);
});
});