Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

ExecuteXMLReader vs ExecuteReader

$
0
0

I created a function that successfully reads an XML string from a recordset into a StringBuilder.  The problem is that when I convert the string to XML it ends up with invalid characters and I get the error "unexpected <EOF>" trying to pass it to XSLT.  I can see that there is XML in the string however.  So it was suggested that we use the ExecuteXMLReader instead of the ExecuteReader method to retrieve the data and then return it as an XMLReader instead of a StringBuilder. Problem with that is that the ExecuteXMLReader always seems to return null or None where the ExecuteReader returns the XML.  

Here is the code:

Dim returnReader as XmlReader

CONN.Open() Dim command As SqlCommand = _ BuildQueryCommand(storedProcName, parameters) ' this function just adds the parameters to the command object command.CommandType = CommandType.StoredProcedure returnReader = command.ExecuteXmlReader() Return returnReader

The returnReader has a value of null where the same process using the ExecuteReader would return the proper results


Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>