[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 605
  • Last Modified:

VB.net SQL Timeout Issue

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
Murray Brown
Asked:
Murray Brown
2 Solutions
 
Vitor MontalvãoMSSQL Senior EngineerCommented:
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
 
Fernando SotoRetiredCommented:
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
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks very much
0

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now