要增加超时时间

编程入门 行业动态 更新时间:2024-10-26 03:36:51
本文介绍了要增加超时时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我要增加超时period.Following是我的code。

I have to increase timeout period.Following is my code.

Private Function GetConnectionInstance() As SqlConnection Dim objConn As SqlConnection Dim strConnection As String strConnection = ConfigurationSettings.AppSettings("conn") Try objConn = New SqlConnection(strConnection) Catch ex As Exception End Try Return objConn End Function

什么$ C $词要在上面添加,以增加超时时间。

What code i have to add in above to increase timeout period.

推荐答案

您需要到下一个项目添加到您的连接字符串:

You need to add the next item into your connection string:

连接超时= 30;

如果您需要更改超时只为目标连接,而不是在整个应用程序,下一步:

If you need to change Timeout only for target connection, not in the whole application, do next:

Dim connString as String = ConfigurationSettings.AppSettings("conn") Dim builder As New SqlConnectionStringBuilder(connString) builder.ConnectTimeout = 30; Dim connection = New SqlConnection(builder.ToString())

更多推荐

要增加超时时间

本文发布于:2023-11-27 02:55:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1636273.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:时间

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!