The command timeout that you can set refers to how long you provide ADO.NET to do your job.
If you call cmdQuery.ExecuteNonQuery() , which returns nothing and executes an SQL statement, this is the time it takes to execute this statement.
If you call cmdQuery.ExecuteReader() , which returns a data reader, this is the time ADO.NET needs to create / create this device to read data so that you can use it.
If you call cmdQuery.ExecuteScalar() , which returns a single scalar value, this is the time it takes to execute the query and get this single result.
If you use dataAdapter.Fill() to populate a data table or dataset, this is the time it takes ADO.NET to retrieve the data, and then populate the data table or dataset.
In general: the timeout is applied to that part of the task that ADO.NET can perform - it executes the operator, fills the data set, returns a scalar value.
Of course, it does NOT apply to the time it takes YOU to repeat the results (in the case of reading data). That would not make sense ...
Mark
marc_s
source share