Timeout Expired 80040e31 using VB to call SQL sp

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!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brian CroweDatabase AdministratorCommented:
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Try setting your CommandTimeout property to a higher value than the default 30 seconds.

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.


Protecting & Securing Your Critical Data

Considering 93 percent of companies file for bankruptcy within 12 months of a disaster that blocked access to their data for 10 days or more, planning for the worst is just smart business. Learn how Acronis Backup integrates security at every stage

IDIeeAuthor Commented:
Thank you, I'll try and then get back to assign points.
Anthony PerkinsCommented:
>>or the default of 15 sec.<<
We are talking about the ADO CommandTimeout here not the ConnectionTimeout
ac, you are of course right :-) I missed on that
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.