在 command.ExecuteReader() 上执行以下代码失败,但有异常:
“错误 [] [U2] [UCINET-UO] 错误 [] [U2] [UCINET-UO] [U2][UCINET-UO] [U2][UCINET-UO] XTOOLSUB 子程序失败。登录帐户 (2)。无效的帐户名 /data/TSSA9。确保 /data/TSSA 帐户列在 ud_database 文件和 UD.ACCOUNT 中。类名 = UDAttribute 方法名 = GetAttributes(...) 类名 = UDAttribute 方法名 = GetAttributes(... ) 来源:U2.Data.Client 目标站点:U2.Data.Client.NativeAccess.TableInfoForNativeAccess GetTableInformation(U2.Data.Client.U2Command)"
using (var connection = ConnectionFactory.Create())
using (var command = connection.CreateCommand())
{
command.CommandText = "Select ID From CONTRACTORS;";
connection.Open();
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
var o = reader[0];
}
}
}
public class ConnectionFactory
{
public const string Password = "****";
public const string UserName = "****";
public const string Server = "****";
public static U2Connection Create()
{
var connectionStringBuilder = new U2ConnectionStringBuilder
{
UserID = UserName,
Password = Password,
Server = Server,
Database = "/data/TSSA",
ServerType = "UNIDATA",
AccessMode = "Native", // FOR UO
RpcServiceType = "udcs", // FOR UO
Connect_Timeout = 9000,
QueryTimeout = 9000,
PersistSecurityInfo = true,
Pooling = false
};
return new U2Connection
{
ConnectionString = connectionStringBuilder.ToString()
};
}
}
我正在使用 U2.Data.Client 版本 2.1.0.2051
任何想法或想法将不胜感激。谢谢。