?
Solved

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

Posted on 2003-11-12
5
Medium Priority
?
414 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
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
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

770 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