Getting a Timeout using an ObjectDataSource

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
 
A

Andrew Cooper

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top