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:



Je veut appeler la méthode SelectCommandTimeout sur mon objet AlarmsDataTableTableAdapter.

Voici le code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 : Sélectionner tout - Visualiser dans une fenêtre à part
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