ExecuteXmlReader
This method executes the command using the XmlCommandType
and CommandText
properties and returns the result as an XML document in a .NET XmlTextReader
object.
Declaration
// C# public XmlReader ExecuteXmlReader();
Return Value
An XmlReader
.
Remarks
The behavior of ExecuteXmlReader
varies depending on the XmlCommandType
property value:
-
XmlCommandType
=OracleXmlCommandType.None
ExecuteStream
throws anInvalidOperationException
. -
XmlCommandType
=OracleXmlCommandType
.Query
ExecuteXmlReader
executes the select statement in theCommandText
property, and if successful, returns a .NETXmlTextReader
object containing the XML document that was generated.If the XML document is empty, which can happen if the SQL query does not return any rows, then an empty .NET
XmlTextReader
object is returned. -
XmlCommandType
=OracleXmlCommandType
.Insert
,OracleXmlCommandType
.Update
, orOracleXmlCommandType
.Delete
.The value of the
CommandText
property is an XML document, andExecuteXmlReader
saves the changes in that XML document to the table or view that is specified in theXmlSaveProperties
property. An empty .NETXmlTextReader
object is returned.