Long Command
Options
I'm running a command.executenonquery() that takes more than a minute, but I get a command timeout. I increase the this.commandtimeout to 60*60*60, but it's to no effect.
Basically, I'm trying to clean out about 400k rows from a table (not the entire table). I had to do this in SQL Management Studio to get my work done.
Basically, I'm trying to clean out about 400k rows from a table (not the entire table). I had to do this in SQL Management Studio to get my work done.
Comments
-
Does it time out if you set the language to 'SQL' and run the SQL statement?
CommandTimeout should definitely work. LINQPad sets this to zero on its own commands for an infinite timeout. Where are you getting the command from? -
Ok thanks, that worked..
But sometimes, I need to do this in a script mixed in with LINQ-SQL in which case I do something like this.....
Connection.Open();
var cmd = this.Connecition.CreateCommand();
cmd.CommandText = "delete from {somebigtable} where {somelargewhereclause}";
cmd.ExecuteNonQuery();
-
And if you do this:
var cmd = this.Connecition.CreateCommand();
cmd.CommandTimeout = 0;
cmd.CommandText = "delete from {somebigtable} where {somelargewhereclause}";
cmd.ExecuteNonQuery();
...does it timeout? -
Ah that did it. Thanks!