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?
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
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.


Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.