Solved

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

Posted on 2003-11-12
5
408 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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
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.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

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