Jurica Smircic said:
Is there any way to change CommandTimeout on commands that are generated
using TableAdapter wizard?
Ah, the power of partial classes! Create and include a file that contains
something like below (make it match the generated code) then in, for instance
Form1.cs, do:
private void Form1_Load ( object sender , EventArgs e )
{
this.xxxTableAdapter.SelectCommandTimeout = 0 ;
this.xxxTableAdapter.Fill ( this.xxxDataSet.xxx );
}
-----------------------
namespace xxx.xxxDataSetTableAdapters
{
public partial class xxxTableAdapter
{
public int InsertCommandTimeout
{
get
{
return ( this._adapter.InsertCommand.CommandTimeout ) ;
}
set
{
this._adapter.InsertCommand.CommandTimeout = value ;
}
}
public int UpdateCommandTimeout
{
get
{
return ( this._adapter.UpdateCommand.CommandTimeout ) ;
}
set
{
this._adapter.UpdateCommand.CommandTimeout = value ;
}
}
public int DeleteCommandTimeout
{
get
{
return ( this._adapter.DeleteCommand.CommandTimeout ) ;
}
set
{
this._adapter.DeleteCommand.CommandTimeout = value ;
}
}
public int SelectCommandTimeout
{
get
{
return ( this._commandCollection[0].CommandTimeout ) ;
}
set
{
for ( int i = 0 ; i < this._commandCollection.Length ; i++ )
{
if ( ( this._commandCollection [ i ] != null ) )
{
( (System.Data.SqlClient.SqlCommand) (
this._commandCollection [ i ] ) ).CommandTimeout = value ;
}
}
}
}
}
}