Solved

VB.net SQL Timeout Issue

Posted on 2014-11-27
3
419 Views
Last Modified: 2014-11-30
Hi

I add "Connection Timeout=300" to my VB.net connection string as shown by an expert but it still times out
after around 20 seconds as opposed to the 300 seconds I have set it to. What am I doing wrong?
I am using the SQLBulkCopy class so need things to run longer


"Server=xxxxxx;Database=Demo2;Uid=Demo2;Password=xxxxx;Connection Timeout=300"
0
Comment
Question by:Murray Brown
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 51

Accepted Solution

by:
Vitor Montalvão earned 250 total points
ID: 40469063
Connection timeout is different from Command timeout. The first is only used when you open a connection to SQL Server database. The second is used in each command that you are sending to SQL Server.
0
 
LVL 63

Assisted Solution

by:Fernando Soto
Fernando Soto earned 250 total points
ID: 40469300
To set the the command timeout do something like this.

connection.Open()
Dim command As SqlCommand = New SqlCommand(queryString, connection)
'' Setting command timeout to 40 second
command.CommandTimeout = 40

Open in new window

0
 

Author Closing Comment

by:Murray Brown
ID: 40473168
Thanks very much
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question