我正在使用 AdomdConnection 连接类连接到多维数据集。我正在使用以下代码。
using (var conn = new AdomdConnection(ConnString))
{
conn.Open();
var cube = conn.Cubes[name];
//Do something
conn.Close();
}
AdomdConnection.ConnectionTimeout Property does not have setter property.
connectionTimeOut 属性的默认值为 0,这会将时间设置为无限。
我有两个问题:
- 有什么方法可以设置 AdomdConnection 的超时属性吗?
- 当多维数据集繁忙并且您尝试运行程序时,在创建连接后打开连接(conn.open())时,系统不会退出此语句并且永远不会执行下一行代码。在这种情况下,应用程序变得不负责任并且不会抛出异常。我如何通知用户此类情况并创建日志条目。
我调查了this similar tread但没有发现它有用。
谢谢
最佳答案
文档对此进行了说明 AdomdConnection.ConnectionTimeout
Gets the time to wait for a connection to be established before the AdomdConnection stops trying to connect and generates an error.
这意味着与服务器通信超时。
如果您希望在运行实际命令时超时,请使用 AdomdCommand.CommandTimeout
属性。
Gets or sets the time to wait for a command to run before the AdomdCommand stops trying to run the command and generates an error.
两者都可以通过连接字符串进行设置。
关于c# - 无法设置 ADOMDConnection 类的超时属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21158477/