Control TableAdapter Command Timeout Globally
问题 I have a DataSet with a QueriesTableAdapter. In order to control the SqlCommand.CommandTimeout I've added a partial class called QueriesTableAdapter with a public method called ChangeTimeout. partial class QueriesTableAdapter { public void ChangeTimeout(int timeout) { foreach (System.Data.SqlClient.SqlCommand cmd in CommandCollection) { cmd.CommandTimeout = timeout; } } } For every DataSet I have that has a QueriesTableAdapter, I can set the CommandTimeout prior to executing. using (NameSpace