Wednesday, 15 January 2014

c# - how to fetch result from "for xml path"? -


Now I have a stored procedure (SQL Server) that will return XML to the "XML path" statement. I have tried to read the reaction with ExecuteXmlReader and ExecuteReader, but I did not find anything. I have some time in Google but still can not find how to get the return value, or how to return the return value. Should I Use ExecuteXmlReader? or something else? Thank you.

  to open (); String result = ""; XmlReader tmp = cmd.ExecuteXmlReader (); While (TMP Reid ()) {string s = tmp.Value; } Return results;    

ReadOuterXml method gives the current node and all this one The child or element is located on the node, otherwise it returns an empty string. You can read the nodes feature by index or name.

  XmlReader tmp = cmd.ExecuteXmlReader (); Tmp.Read (); While (! Tmp.EOF) {string name = tmp ["attributeName"]; String s = tmp.ReadOuterXml (); }  

No comments:

Post a Comment