相关疑难解决方法(0)

连接关闭后,未提交的事务会发生什么?

它们会立即回滚吗?它们会在一段时间后回滚吗?他们是否处于未承诺状态?

如果使用连接池并且只是重置连接,行为是否相同?

sql sql-server transactions connection-pooling

43
推荐指数
3
解决办法
3万
查看次数

如何将CommandTimeout添加到web.config中的连接字符串

如何将CommandTimeout添加到web.config中的连接字符串?

我试过了:

<add name="ConnectionString" connectionString="Data Source=;Initial Catalog=;Persist Security Info=True;User ID=sa;Password=sa@123;Connect Timeout=200" providerName="System.Data.SqlClient"/>

</connectionStrings>
Run Code Online (Sandbox Code Playgroud)

还有这个:

<add name="MyProject.ConnectionString"  
         connectionString="Data Source=127.0.0.1;Initial Catalog=MyDB;Persist Security Info=True;CommandTimeout=60;User ID=sa;Password=saPassw0rd"
         providerName="System.Data.SqlClient" />
Run Code Online (Sandbox Code Playgroud)

但它并没有为我工作.

谢谢

connection-string timeout web-config connection-timeout

9
推荐指数
2
解决办法
5万
查看次数

如何设置CommandTimeout

我在用 Microsoft.SqlServer.Management.Smo.

我的代码:

Server server = new Server(new ServerConnection( new SqlConnection(ConnectionString));
server.ConnectionContext.ExecuteNonQuery(script);
Run Code Online (Sandbox Code Playgroud)

我想像CommandTimeout平常那样设置它SQLCommand

请告诉我如何设置CommandTimeout查询运行Microsoft.SqlServer.Management.Smo.Server

c# smo sqlcommand command-timeout

8
推荐指数
2
解决办法
1万
查看次数

SQL 连接字符串的 CommandTimeout

如何从 SQL Server 中的连接字符串进行配置CommandTimeout(不是Connect Timeout)?

我以为很容易找到,但显然不是。下面我添加了CommandTimeout=60。它似乎没有破坏任何东西,但我不知道它是否真的有效(而且我找不到这方面的文档)

Data Source=someplace.com;Initial Catalog=MyDB;CommandTimeout=60;User Id=someID;Password=secret;
Run Code Online (Sandbox Code Playgroud)

sql-server

1
推荐指数
1
解决办法
5939
查看次数