Updated: Setting CommandTimeOut di TableAdapter

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;
                        }
                    }
                }
            }
        }

Related Posts

Setting CommandTimeOut di TableAdapter
Secara default, TableAdapter menggunakan TimeOut 30s untuk setiap interaksi-nya ke database. Namun ada...
System.GUID untuk identitas unik dari object
Bila anda sering bermain dengan `object` maka anda mau tidak mau akan membutuhkan UUID (Universally Unique...
Error `Session state has created a session id, but cannot save it because the response was already flushed by the application.` di ASP.NET
Beberapa waktu belakangan ini saya sering menemukan pesan error: Session state has created a session...
Windows Server 2008 di Notebook HP Pavilion DV2100CTO
HP Pavilion DV2100CTO saya memang sudah nyaris menjadi bangkai... teronggok dengan manisnya di pojokan....

Leave a Reply

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


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>