?
Solved

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

Posted on 2003-11-12
5
Medium Priority
?
415 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
[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
  • 2
5 Comments
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 500 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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

649 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