How can I change the table adapter's command timeout

后端 未结 15 1305
遇见更好的自我
遇见更好的自我 2020-12-10 02:12

I\'m using Visual Studio 2008 with C#.

I have a .xsd file and it has a table adapter. I want to change the table adapter\'s command timeout.

Thanks for your

15条回答
  •  醉梦人生
    2020-12-10 03:03

    If you go to [name of DataSet].Designer.cs which is a file added under the data set file in the solution and then search for :

     private void InitCommandCollection();
    

    This is a function that you should be able to set properties for functions that have been defined in a table adapter.

    The first line in that function is

    this._commandCollection = new global::System.Data.IDbCommand[];
    

    and then in the next line for each of those function, you can set

    ((global::System.Data.SqlClient.SqlCommand)(this._commandCollection[])).CommandTimeout = 0;
    

    which 0 indicates no limitation and the function will not stop due to the time out and also it can be set to 10, 20, 30 or 1000 and so on

提交回复
热议问题