Getting a Timeout in my SQLConnection

  • Thread starter Thread starter Dom
  • Start date Start date
D

Dom

I'm not sure if this is a question about CSharp, or SQL. But I'll try
here first.

I have several SQL scripts to run, and I'd like to automate the
process, so I am using CSharp and the SqlConnection object and related
objects (such as SqlCommand, etc).

Each SQL script does an INSERT, and it takes quite some time, maybe 20
minutes or more. I know this because each script has been tested in
QA. I pass the exact same SQL script to the SqlCommand, but CSharp
gives me a timeout after a minute or so. The connectionstring uses
"Connection Timeout = 0", but no luck.

Any ideas? BTW, am I right in thinking that CSharp and the SQLxxx
objects are the best approach?

Dom
 
You need to set the COMMAND timeout, not the CONNECTION timeout.

Connection Timeout means "Try to talk to the server in this amount of time"

Command Timeout is the amount of time a (usually stored procedure or query)
runs.
 
You need to set the COMMAND timeout, not the CONNECTION timeout.

Connection Timeout means "Try to talk to the server in this amount of time"

Command Timeout is the amount of time a (usually stored procedure or query)
runs.










- Show quoted text -

Thanks. Work perfectly.

Dom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top