我正在使用以下代码连接到 Ms SQL-Server
var node_mssql = require('node-mssql');
/* add configuration to query object */
var queryObj = new node_mssql.Query({
host: '127.0.0.1', // You can use 'x.x.x.x\\instance' to connect to named instance
port: 1433,
username: 'myuser',
password: 'mypwd',
database: 'persondb'
});
/* set table name to operate */
queryObj.table('dbo.Person');
/* set update query condition */
queryObj.where({
'FirstName': 'Mathias',
})
/* run update query and fetch response */
queryObj.select(function(results) {
// success callback
console.log(results);
}, function(err, sql) {
// failed callback
if(err)
console.log(err);
console.log(sql);
});
我得到错误
Invalid object name "undefined.dbo.Person."
Select * FROM undefined.dbo.Person WHERE FirstName = 'Mathias'
看起来服务器名称没有被拾取。如何解决此问题以连接到 Sql-Server?