Page 1 of 1

setting the CommandTimeout for a dataset?

Posted: Wed 20 Sep 2006 20:13
by mr breaker
I am getting a timeout every so often when performing a long query. (VS 2005).

I have a typed Dataset and I am calling a stored procedure from a TableAdapter.


How can I set the CommandTimeout? I searched through the forum but couldn't find a way to do it.


Thanks!

Posted: Thu 21 Sep 2006 07:11
by Alexey
Try to set the CommandTimeout in your .Designer.cs file.

Posted: Tue 03 Oct 2006 19:13
by mr breaker
Do you have an example of this? I haven't been able to figure it out.


Thanks.

Posted: Tue 03 Oct 2006 21:18
by mr breaker
I think I did figure it out.


Here's the function to modify in case others run into it:

Code: Select all

  _
        Private Sub InitCommandCollection()
            Me._commandCollection = New CoreLab.MySql.MySqlCommand(0) {}
            Me._commandCollection(0) = New CoreLab.MySql.MySqlCommand
            Me._commandCollection(0).Connection = Me.Connection
            Me._commandCollection(0).CommandText = "thomas_global_reports_masters.Bot_SelectSessions"
            Me._commandCollection(0).CommandType = System.Data.CommandType.StoredProcedure
            Me._commandCollection(0).CommandTimeout = 0
        End Sub

At the top of the page it says that this file is auto-generated and changes may be lost. Is there any way to avoid that?

Posted: Wed 04 Oct 2006 07:34
by Alexey
Changes may be lost only if the code is regenerated.