Solved

Getting time out error running a query on SQL Server 2000 DB from VB

Posted on 2003-11-12
5
410 Views
Last Modified: 2008-03-06
I'm working on an application in VB environment. The database that I'm using is of MS SQL Server 2000. When I run the application it often happens that running any complicated or large query from VB gives timeout error, whereas running the same query using Query Analyzer of MS SQL Server 2000 works although it takes some time. How can I get rid of it?
0
Comment
Question by:saclain
  • 2
5 Comments
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 125 total points
ID: 9737315
The difference is that Query Analyzer does not have a timeout and ADO has a default timeout of 30 seconds.  So depending how you are executing the SQL statement you need to either increase the CommandTimeout property or set it to 0 (infinite) to be the same as Query Analyzer.

And of course the better answer is to analyze why it is taking so long in the first place.

Anthony
0
 

Expert Comment

by:kauf
ID: 9744075
You can set the ADO timeout if you steer your query through several objects.

Try this:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdaexamples_vb01_4.asp
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 10143264
Do you need any more help?
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

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.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
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.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

777 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