Connection timeout in SMO ServerConnection

Connection timeout in SMO

 

回答1

Apparently ServerConnection also has a statement timeout. SMO is full of these hidden timeouts. Including SQLBulkCopy. However, thanks to @Derek for pointing this out. The answer is you have to set the StatementTimeout = 0. I am testing this now but it appears to be the answer.

How to set CommandTimeout

http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.common.serverconnection.statementtimeout.aspx

 

How to set CommandTimeout

问题

I am using Microsoft.SqlServer.Management.Smo.

My Code:

Server server = new Server(new ServerConnection( new SqlConnection(ConnectionString));
server.ConnectionContext.ExecuteNonQuery(script);

I want to set CommandTimeout for it like we do with normal SQLCommand

Please tell me how to set CommandTimeout for queries running through Microsoft.SqlServer.Management.Smo.Server

 

 回答

Try server.ConnectionContext.StatementTimeout

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(48)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2021-05-07 《数学模型》(第5版) 张瑞@中国科大
2021-05-07 图论建模
2021-05-07 狼羊过河问题
2021-05-07 NEW SECRET “???” ACHIEVEMENT AND CARD BACK FROM BARRENS – MYSTERIES OF THE PHOENIX – FULL SOLUTION INSIDE!
2021-05-07 凤凰之谜卡背 new card back "secrets of the phoenix"
2020-05-07 git switch
2020-05-07 Reentrant mutex可重入互斥锁
点击右上角即可分享
微信分享提示