Getting a Timeout using an ObjectDataSource

  • Thread starter Thread starter Andrew Cooper
  • Start date Start date
A

Andrew Cooper

I've got a report that is using an ObjectDataSource to populate its
data. The problem is that the report takes longer than 30 seconds to
generate so it times out. If I were using an SQLDataSource object I
know how to set the Command.Timeout to account for this but I can't find
the Timeout property on the ObjectDataSource to do this. How can I set
the Timeout property on an ObjectDataSource?

Thanks,

Andrew
 
Andrew said:
I've got a report that is using an ObjectDataSource to populate its
data. The problem is that the report takes longer than 30 seconds to
generate so it times out. If I were using an SQLDataSource object I
know how to set the Command.Timeout to account for this but I can't find
the Timeout property on the ObjectDataSource to do this. How can I set
the Timeout property on an ObjectDataSource?

Thanks,

Andrew


Okay, this really shouldn't be as hard as it is turning out to be. It
looks like the only way to access the CommandTimeOut property on the
ObjectDataSource is to create a Partial Class and then set the property
there. Here's the code I got online to do this...

-------------------

Namespace programTableAdapters
{
Partial Public Class OrderTableAdapter
{
public void SetCommandTimeout(int timeout)
{
foreach (IDbCommand command in CommandCollection)
command.CommandTimeout = timeout;
}
}
}

-------------------

I tried converting it over to VB but I've run into problems. My code is
below. This issue is that the CommandCollection doesn't seem to exist
anywhere. Any help with this would be greatly appreciated. It's
frustrating to have everything working and the only thing holding me up
is a stupid Timeout error.

-------------------

Imports Microsoft.VisualBasic

Namespace NewReportingDataSet
Partial Public Class usp_Billing_Report_by_MainTableAdapter
Public Sub SetCommandTimeout(ByVal timeout As Integer)
Dim test As System.Data.IDbCommand

For Each test In CommandCollection
test.CommandTimeout = timeout
Next
End Sub
End Class
End Namespace
 
Back
Top