1

I have a TableAdapter generated by the Visual Studio dataset designer.

Owing to some fabulous coding by my illustrious predecessor, this stored function returns a mountain of data, and I'm trying to solve that problem, but in the meantime, the procedure is timing out because all of the data isn't returned by the time the connection is set to time out.

myProcedureTableAdapter.Adapter.SelectCommand is null at runtime, as are DeleteCommand, InsertCommand and UpdateCommand. The variable I want is contained in myProcedureTableAdapter.CommandCollection[0], but that's protected.

How can I extend the timeout on this TableAdapter?

EDIT: I can actually run the Fill and GetData commands on the TableAdapter, so the select command obviously exists in some context (i.e. as a member of CommandCollection), I just can't access that command via the SelectCommand property.

EDIT2: Well, this is vexing. I've gone into the generated code and found the following:

Public Overloads Overridable Function GetData() As DataSet_myDataSet.myProcedureDataTable
    Me.Adapter.SelectCommand = Me.CommandCollection(0)

This shows that the SelectCommand isn't being set until I'm actually in the process of selecting stuff. This is insane.

I'm going to try creating a readonly property in a partial class, and have that directly reference Me.CommandCollection(0). It's terrible coding practice, but I can't see any other option at this point.

I'll leave this question here in case someone comes along with a sane idea.

Frosty840
  • 7,965
  • 12
  • 50
  • 86
  • I think the question [might be a duplicate of this](http://stackoverflow.com/questions/1192171/how-can-i-change-table-adapters-command-time-out). Does that help? – Cerbrus Dec 03 '12 at 13:40
  • For some reason, the SelectCommand property isn't initialised. The command that *is* the SelectCommand is initialised, and is present in the `CommandCollection`, but `CommandCollection` is a protected property. I can't decide if I'm doing something stupid, or if the code isn't being generated properly. – Frosty840 Dec 03 '12 at 13:45

0 Answers0