Solved

VB.net SQL Timeout Issue

Posted on 2014-11-27
3
355 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:murbro
[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 49

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:murbro
ID: 40473168
Thanks very much
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
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.

761 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