Appliquer un commandtimeout à un TableAdapter associé a un DataSource
Bonjour,
J'aimerai savoir comment récupérer l'instance de mon TableAdapter que j'ai associer à mon dataSource pour lui appliquer la une méthode dans une classe partiel pour changer la valeur du commandtimeout ?
J'ai fait l’association de mon DatatableAdapter avec mon DataSource avec les outil graphique:
http://www.developpez.net/forums/u55265-a439-i1555.png
http://www.developpez.net/forums/u55265-a439-i1554.png
Je veut appeler la méthode SelectCommandTimeout sur mon objet AlarmsDataTableTableAdapter.
Voici le code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
namespace AlarmsTableAdapters
{
partial class AlarmsDataTableTableAdapter
{
public int SelectCommandTimeout
{
set
{
for (int i = 0; i < this.CommandCollection.Length; i++)
{
if (this.CommandCollection[i] != null)
{
this.CommandCollection[i].CommandTimeout = value;
}
}
}
}
}
} |
Code la page web :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
<tr>
<td colspan="2">
<asp:ObjectDataSource ID="AlarmsObjectDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
SelectMethod="GetAlarms" TypeName="AlarmsTableAdapters.AlarmsDataTableTableAdapter"
OnSelected="AlarmsObjectDataSource_Selected">
<SelectParameters>
<asp:ControlParameter ControlID="TxtStartDate" DefaultValue="01/01/1970 00:00:00" Name="Start_Date" PropertyName="Text" Type="DateTime" />
<asp:ControlParameter ControlID="TxtEndDate" DefaultValue="01/01/1970 00:00:00" Name="End_Date" PropertyName="Text" Type="DateTime" />
<asp:ControlParameter
</asp:ObjectDataSource>
</td>
</tr> |
Merci d'avance :ccool: