Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Posted

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.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...