Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27203

[RESOLVED] Issues with DataTable.ReadXml

$
0
0
First I'd like to say how I hate that Visual Studios absorbs any errors in the form load event of Win7 64-Bit computers. Anyways... I have the writing the DataTable to XML down, pretty much I doing this:

Code:

                path = IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "login.xml")
                Using fs As New IO.FileStream(path, IO.FileMode.CreateNew)
                    Dim new_table As New DataTable
                    new_table.Columns.AddRange({New DataColumn("id"), New DataColumn("user"), New DataColumn("pass"), New DataColumn("admin")})

                    new_table.TableName = "login"

                    Dim admin As DataRow = new_table.NewRow
                    admin(0) = 0
                    admin(1) = "admin"
                    admin(2) = "admin"
                    admin(3) = True

                    new_table.Rows.Add(admin)

                    new_table.WriteXml(fs)
                End Using

However, whenever I go to load the XML I get this error:
Code:

DataTable does not support schema inference from Xml.
The way I'm trying to load the DataTable is simple:
Code:

        Dim dt As New DataTable
        dt.ReadXml(path)

How is it that the DataTable doesn't support the schema that was created by a DataTable?

Viewing all articles
Browse latest Browse all 27203

Trending Articles



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