Beruflich Dokumente
Kultur Dokumente
Introduction
3. XmlReader - use it to provide a read only, forward only data stream of XML
data.
Use DataSet
Use SqlDataReader
1. We are dealing with large volumes of data - too much to maintain in single
cache.
4. When accessing data by using the reader, use the typed accessor methods
like GetInt32, GetString as they reduce the amound ot type convertion
required when reading the column data.
5. To avoid unnecessary data pulling from the datbase, use Cancel method of
Command object (dCmd.Cancel()) before closing the reader. (lets say you
have 100 records into the reader and after looping through 10 records you
think that you got the data you needed then before closing the reader call
Cancel method of the command object) This ensures that the results are
discarded on the server and are not pulled unnecessarily to the client.
Use XmlReader
1. The connection must remain open while we read the data from XmlReader.
There is no support of CommandBehavior.CloseConnection as in case of
SqlDataReader so we should close the connection explicitly.