?
Solved

Timeout expired for executing ms-sql store procedure?

Posted on 2002-07-10
7
Medium Priority
?
423 Views
Last Modified: 2012-06-21
I receive time out error message for executing ms-sql store procedure message (Timeout expired -2147217871) using ADODB.Connection

How to I increase Time Out interval?
0
Comment
Question by:AStronus
[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
7 Comments
 

Expert Comment

by:itmelo
ID: 7144697
For a Connection:
oConn.ConnectionTimeout = 30
For a Command:
oCmd.CommandTimeout = 30
0
 
LVL 1

Accepted Solution

by:
gallo47 earned 800 total points
ID: 7144703
This is the code I use for stored procedures:

Dim cn As ADODB.Connection
Dim RS As ADODB.Recordset
Dim cmd As ADODB.Command

Set cn = New ADODB.Connection
cn.Open "Provider=SQLOLEDB.1;User ID=uid;Password=pw;Initial Catalog=dbname;Data Source=server"

Set cmd = New ADODB.Command

With cmd
     .ActiveConnection = cn
     .CommandText = "usp_SPName"
     .CommandType = adCmdStoredProc
     .Parameters("@Param1") = SomeValue
     .CommandTimeout = 300  'This is where the timeout is set
End with

Set RS = cmd.Execute
0
 
LVL 1

Expert Comment

by:gallo47
ID: 7144705
Sorry itmelo beat me to it
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:AStronus
ID: 7144792
I'm using ConnectionString
and set
oConn.ConnectionString="...."
oConn.ConnectionTimeout=900000000
oConn.Open
recordset=OConn.Execute("....")
but I still receive Time out
:(
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 7145083
Set the CommandTimeout not the ConnectionTimeout property.  In other words:
oConn.ConnectionString="...."
oConn.CommandTimeout = 0  'Infinite timeout
oConn.Open
recordset=OConn.Execute("....")

Anthony
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7145471
If the stored procedure times out, you might first check how much time it needs to execute (using query analyser). If there it takes only seconds, then you need to check why the connection takes so much time, otherwise start optimizing the proc

CHeers
0
 

Author Comment

by:AStronus
ID: 7146455
ConnectionTimeout doesn't work for me, as I change ConnectionString to ADODB.Command and set Time out it's work great.  Sorry, all answer is correct but I can give pts to 1 person only.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

762 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