Sql server 请求错误:{message:';请求只能在LoggedIn状态下进行,而不能在SentLogin7WithStandardLogin状态下进行';,代码:';EINVALIDSTATE';}

Sql server 请求错误:{message:';请求只能在LoggedIn状态下进行,而不能在SentLogin7WithStandardLogin状态下进行';,代码:';EINVALIDSTATE';},sql-server,node.js,npm,tedious,Sql Server,Node.js,Npm,Tedious,当使用包冗长连接到MSSQL时,我在请求测试中遇到以下错误: “只能在LoggedIn状态下发出请求,而不能在SentLogin7WithStandardLogin状态下发出请求”,代码:“EINVALIDSTATE” 我的代码(摘自示例:): var Connection=require(‘冗长’)。连接; 变量配置={ 用户名:“xpto”, 密码:“pass”, 服务器:“myserver”, 选项:{encrypt:true,数据库:'dbname'} }; var连接=新连接(配置)

当使用包
冗长
连接到MSSQL时,我在请求测试中遇到以下错误:

“只能在LoggedIn状态下发出请求,而不能在SentLogin7WithStandardLogin状态下发出请求”,代码:“EINVALIDSTATE”

我的代码(摘自示例:):


var Connection=require(‘冗长’)。连接;
变量配置={
用户名:“xpto”,
密码:“pass”,
服务器:“myserver”,
选项:{encrypt:true,数据库:'dbname'}
};
var连接=新连接(配置);
connection.on('connect',函数(err){
var Request=require(‘冗长’)。Request;
请求=新请求(“选择42,‘hello world’”,函数(err,rowCount){
如果(错误){
console.log('ERROR');
控制台日志(err);
}否则{
log(rowCount+rows');
}
});
请求.on('行',函数(列){
columns.forEach(函数(列){
console.log(column.value);
});
});
connection.execSql(请求);
});

提前谢谢。

我的问题是连接超时

connect
事件上的
err
参数返回以下消息:

{消息:“无法连接到ip_my_服务器:15000ms中的1433”,代码:“ETIMEOUT”}

请参见项目的github中对我的问题的评论:


谢谢

在您的
config
中,您是在指定SQL Server用户/密码还是在使用Windows用户帐户?是的,David。用户和密码。