Long Command
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
CommandTimeout should definitely work. LINQPad sets this to zero on its own commands for an infinite timeout. Where are you getting the command from?
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();
var cmd = this.Connecition.CreateCommand();
cmd.CommandTimeout = 0;
cmd.CommandText = "delete from {somebigtable} where {somelargewhereclause}";
cmd.ExecuteNonQuery();
...does it timeout?