문제

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