Reputation: 747
I have some questions from my Test and I want to be sure in my answers. Need to say sentence is true or false. So:
- The DataReader provides a cursor that can be used to move forward and backwards through the result.
False, because cursor can be used to move only to forward, not backwards.
- The DataReader provides random access capabilities on the result.
False, DataReader is cursor and don't allow to random access
- The Application code can reference the first row of a multi-row result set faster than it can be by loading it directly into a DataTable
I think, it's True, but not sure about multi-row.
- The DataReader can provide the Schema of the result to the application code.
I think, it's False, but never found it in documentation (that DataReader does not provide the Schema)
am I right in my answers?
Upvotes: 0
Views: 199
Reputation: 2781
DataReader.GetSchemaTable()
.Upvotes: 1
Reputation: 26
In point 3. - DataReader will read one row at the time so it is faster (to fill table you must get all rows, convert them to objects and attach them to datasource). This is also a problem because (depends on sql configuration) will remain open until you read it all - this may cause some locking issues.
Upvotes: 1