Вопрос

I need to set the commandTimeout for an ObjectDataSource in VB.NET and I can't find any way of doing it. I can do this easily in SqlDataSource but I'm restricted to using an ObjectDataSource.

Any help would be greatly appreciated. Thanks

Нет правильного решения

Другие советы

Answer taken from here.

If you are using a strongly typed TableAdapter you need to edit the generated code by setting the CommandTimeout property on the command(s) in the _commandCollection:

YourDataSet.Designer.cs:

[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "4.0.0.0")]
        private void InitCommandCollection() {
            this._commandCollection = new global::System.Data.SqlClient.SqlCommand[1];
            this._commandCollection[0] = new global::System.Data.SqlClient.SqlCommand();
            this._commandCollection[0].Connection = this.Connection;
            this._commandCollection[0].CommandText = "SELECT * FROM dbo.Table";
            this._commandCollection[0].CommandType = global::System.Data.CommandType.Text;
            this._commandCollection[0].CommandTimeout = 1000; //Timeout in seconds
        }
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top