RonQ Posted December 15, 2003 Posted December 15, 2003 Hello... how are you?! I have some data from a structure array: Public Structure AddressFileHeader Dim VersionTag() As Byte Dim Filename As String Dim Custom1 As String Dim Custom2 As String Dim NextFree As Integer Dim Categories() As SomeDataType Dim FieldCount As Short Dim NumEntries As Integer End Structure I've made a DataSet XML schema of this like it is a table from a database, now I want to add the data in the structure to the dataset like table rows, I know it can be done, but i don't know how to. Do I have to convert this to to XML and then add the xml to the dataset or there is a easyer way to do it?? Thanks, Ronq. Quote
RonQ Posted December 18, 2003 Author Posted December 18, 2003 After not getting an answer I started reading the documentation (should have done that from the begining, although I would have liked some help), and I found the way to do it. Here it is: 'myDataSetSchema is the XML schema describing the data structure as 'a database is a DataSet XML schema. 'Declare a table object for the Table "TableName" Dim myTable As myDataSetSchema.TableNameTable = ds.TableName 'Declare a DataRow object to fill the data and then insert 'to the database Dim myRow As DataRow For I=0 To 10 'Instanciate a new row for the Table "TableName" myRow = myTable.NewRow() 'Fill the row with Data myRow("Filename") = "Pepe" myRow("Custom1") = "X" myRow("FieldCount") = 3 'Add the row to the table myTable.Rows.Add(myRow) Next I Bye, Hope that helps anyone like me.. hehe Ronq. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.