Solved

VB.net SQL Timeout Issue

Posted on 2014-11-27
3
309 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
3 Comments
 
LVL 45

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 62

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
Viewers will learn how the fundamental information of how to create a table.

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now