Timeout Expired 80040e31 using VB to call SQL sp

Posted on 2006-03-20
Last Modified: 2008-01-09
I have a timeout error each time I try to insert a set of records from one SQL DB to another. I call the sp from VB. It's only inserting 65k records. I run the procedure in Query Analyzer and it takes 29 seconds.

Not sure if it is a permissions issue or something else.

Happy to provide additional info.

Thank you!
Question by:IDIee
    LVL 34

    Accepted Solution

    It's going to take a little bit longer to run in VB then in Query Analyzer.  Just extend your timeout period.

    cmd.commandtimeout = 60
    LVL 20

    Expert Comment

    Try setting your CommandTimeout property to a higher value than the default 30 seconds.
    LVL 7

    Expert Comment


    this does not seem like a permission issue.
    What timeout have you set in your connection string? Probably none or the default of 15 sec.
    Try to add this to your Connection String: Timeout=0;
    this will ensure that the connection does not time out at all but rather waits until your commands have finished.



    Author Comment

    Thank you, I'll try and then get back to assign points.
    LVL 75

    Expert Comment

    by:Anthony Perkins
    >>or the default of 15 sec.<<
    We are talking about the ADO CommandTimeout here not the ConnectionTimeout
    LVL 7

    Expert Comment

    ac, you are of course right :-) I missed on that

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
    Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

    745 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

    19 Experts available now in Live!

    Get 1:1 Help Now