Solved

VB.net SQL Timeout Issue

Posted on 2014-11-27
3
372 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 50

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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

734 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