This might be a bit of a late answer but might help someone with the same problem so ...
The idea is to create a base class for the table adapter too inherit which increases the timeout for all commands in the table adapter. It has to use reflection since the generated table adapters don't inherit anything useful. It exposes a public function to alter the timeout.
using System;
using System.Data.SqlClient;
using System.Reflection;
namespace CSP
{
public class TableAdapterBase : System.ComponentModel.Component
{
public TableAdapterBase()
{
}
public void SetCommandTimeout(int Timeout)
{
foreach (var c in SelectCommand())
c.CommandTimeout = Timeout;
}
private System.Data.SqlClient.SqlConnection GetConnection()
{
return GetProperty("Connection") as System.Data.SqlClient.SqlConnection;
}
private SqlCommand[] SelectCommand()
{
return GetProperty("CommandCollection") as SqlCommand[];
}
private Object GetProperty(String s)
{
return this.GetType().GetProperty(s, BindingFlags.NonPublic | BindingFlags.GetProperty | BindingFlags.Instance).GetValue(this, null);
}
}
}
So your example would become:
[System.ComponentModel.DataObjectMethodAttribute
(System.ComponentModel.DataObjectMethodType.Select, false)]
public Scout.ScoutDataTable GetItems(string node, int rank1, int rank2)
{
ScoutTableAdapter Adapter = new ScoutTableAdapter();
Adapter.SetCommandTimeout(60);
return Adapter.GetDataBy(node, rank1, rank2);
}
in the dataset designer the default base class is System.ComponentModel.Component just set it to the above class TableAdapterBase