![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
I have spent countless hours trying to determine the best way to get data from a SQL database into an XML file. I created a SQL stored procedure that returns the detail records as XML. I then combine it with the header information to generate a "complete" XML file in vb.net. This is working exactly how I want with one exception. Every detail record includes xmlns="" and I don't want it included. Anyone have any ideas? |
|
Using conData As SqlConnection = New SqlConnection(DBClass.GetCoreConnectionString) conData.Open() Dim strsql As String = "Exec mc_selEncounterReporting @BatchID=695" Dim Command As New SqlCommand(strsql, conData) Dim i As Integer Using xw As XmlWriter = xpathnav.PrependChild() |
#2
| |||
| |||
|
|
I attempted to follow your advice and use x.LoadXML(xr) but it says "Value of type 'System.XML.XMLReader' cannot be converted to a 'String'. x is an XMLDocument xr is the XMLReader containing the results of the stored procedure. |
#3
| |||
| |||
|
|
Mary wrote: I attempted to follow your advice and use x.LoadXML(xr) but it says "Value of type 'System.XML.XMLReader' cannot be converted to a 'String'. x is an XMLDocument xr is the XMLReader containing the results of the stored procedure. I am sure I suggested to use the 'Load' method, not the 'LoadXML' method. Also note that that suggestion is only possible if you use the FOR XML ROOT instruction to ensure SQL server outputs a root element. -- Martin Honnen --- MVP Data Platform Development http://msmvps.com/blogs/martin_honnen/ |
![]() |
| Thread Tools | |
| Display Modes | |
| |