Dataset TableAdapter CommandTimeout

If get error:
“Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding”

Setting the connection string timeout does not work.

Following links led me to my own visual basic translation. I found i had to add the check for the commandCollection Is Nothing
http://www.velocityreviews.com/forums/t123478-how-to-set-commandtimeout-for-getdata-method-of-tableadapter-asp-net-2-0-a.html
http://www.pcreview.co.uk/forums/tableadapter-and-commandtimeout-t2354775.html

Because the DatasetName.Designer.vb is a partial class, it is possible to create a second partial class which will not be overwritten on changes to the dataset. Remember to use

Namespace xxxTableAdapters

    Partial Public Class xxxTableAdapter

        Public WriteOnly Property SetSelectCommandTimeout() As Integer
            Set(ByVal value As Integer)
                If Me._commandCollection Is Nothing Then
                    Me.InitCommandCollection()
                End If
                Me.CommandCollection(0).CommandTimeout = value
                ‘For Each cmd In Me._commandCollection  ‘To do all
                ‘    cmd.CommandTimeout = value
                ‘Next
            End Set
        End Property

    End Class

End Namespace

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: