Return to Snippet

Revision: 22065
at December 30, 2009 14:04 by JoseKar


Initial Code
Public Function StrXml2Table(ByVal StrXML As String) As DataTable
       Dim ms As MemoryStream
       Dim returnMs As New DataTable()
       Try
           Dim buf() As Byte
           Dim ds As New DataSet

           buf = System.Text.UTF8Encoding.ASCII.GetBytes(StrXML)
           ms = New MemoryStream(buf)

           ds.ReadXml(ms)
           Return ds.Tables(0)
       Catch ex As Exception
           ' Hacer algo o mostrar mensaje de error
           Return returnMs
       Finally
           If Not ms Is Nothing Then
               ms.Close()
           End If
       End Try
   End Function

Initial URL

                                

Initial Description

                                

Initial Title
Conversión de un String XML a un DataTable

Initial Tags
xml, aspnet

Initial Language
VB.NET