node 服务器添加数据到 SQL server
var sql = require("mssql"); var config = { user: "sa", password: "******", //密码 database: 'ShopDB', server: 'localhost', } sql.connect(config, function () { sql.query("insert into dbo.UserTable values('admin','123')", function (error, results, fields) { if (results.rowsAffected[0] >= 1) { sql.query("select * from dbo.UserTable", function (error, results, fields) { console.log(results.recordsets[0]); sql.close(); }); } }); });