Ternyata, object this._adapter lebih sering bernilai null sehingga code dalam partial class table adapter tidak memberikan efek apapun. Namun object this.Adapter ternyata memberikan hasil yang ingin dicapai. Jadi rubah code di tahap 4 yang terdapat disini menjadi:

public int CommandTimeout
        {
            get
            {
                if (this.CommandCollection != null)
                    return (this.CommandCollection[0].CommandTimeout);
                else
                    return 30;
            }

            set
            {
                if (this.Adapter != null)
                {
                    if (this.Adapter.InsertCommand != null)
                        this.Adapter.InsertCommand.CommandTimeout = value;
                    if (this.Adapter.UpdateCommand != null)
                        this.Adapter.UpdateCommand.CommandTimeout = value;
                    if (this.Adapter.DeleteCommand != null)
                        this.Adapter.DeleteCommand.CommandTimeout = value;
                }
                if (this.CommandCollection != null)
                {
                    foreach (System.Data.SqlClient.SqlCommand SelectCommand in this.CommandCollection)
                    {
                        if (SelectCommand != null)
                        {
                            SelectCommand.CommandTimeout = value;
                        }
                    }
                }
            }
        }

Leave a Reply

Your email address will not be published. Required fields are marked *