Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Timeout expired for executing ms-sql store procedure?

Posted on 2002-07-10
7
Medium Priority
?
434 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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

Industry Leaders: 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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

618 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