[SIZE=2]
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] table [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] DataTable = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] DataTable([/SIZE][SIZE=2][COLOR=#800000]"ParentTable"[/COLOR][/SIZE][SIZE=2])
[/SIZE][SIZE=2][COLOR=#008000]' Declare variables for DataColumn and DataRow objects.
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] column [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] DataColumn
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] row [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] DataRow
[/SIZE][SIZE=2][COLOR=#008000]' Create new DataColumn, set DataType, ColumnName
[/COLOR][/SIZE][SIZE=2][COLOR=#008000]' and add to DataTable.
[/COLOR][/SIZE][SIZE=2]column = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] DataColumn()
column.DataType = System.Type.GetType([/SIZE][SIZE=2][COLOR=#800000]"System.Int32"[/COLOR][/SIZE][SIZE=2])
column.ColumnName = [/SIZE][SIZE=2][COLOR=#800000]"id"
[/COLOR][/SIZE][SIZE=2]column.ReadOnly = [/SIZE][SIZE=2][COLOR=#0000ff]True
[/COLOR][/SIZE][SIZE=2]column.Unique = [/SIZE][SIZE=2][COLOR=#0000ff]True
[/COLOR][/SIZE][SIZE=2][COLOR=#008000]' Add the Column to the DataColumnCollection.
[/COLOR][/SIZE][SIZE=2]table.Columns.Add(column)
[/SIZE][SIZE=2][COLOR=#008000]' Create second column.
[/COLOR][/SIZE][SIZE=2]column = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] DataColumn()
column.DataType = System.Type.GetType([/SIZE][SIZE=2][COLOR=#800000]"System.String"[/COLOR][/SIZE][SIZE=2])
column.ColumnName = [/SIZE][SIZE=2][COLOR=#800000]"ParentItem"
[/COLOR][/SIZE][SIZE=2]column.AutoIncrement = [/SIZE][SIZE=2][COLOR=#0000ff]False
[/COLOR][/SIZE][SIZE=2]column.Caption = [/SIZE][SIZE=2][COLOR=#800000]"ParentItem"
[/COLOR][/SIZE][SIZE=2]column.ReadOnly = [/SIZE][SIZE=2][COLOR=#0000ff]False
[/COLOR][/SIZE][SIZE=2]column.Unique = [/SIZE][SIZE=2][COLOR=#0000ff]False
[/COLOR][/SIZE][SIZE=2][COLOR=#008000]' Add the column to the table.
[/COLOR][/SIZE][SIZE=2]table.Columns.Add(column)
[/SIZE][SIZE=2][COLOR=#008000]' Make the ID column the primary key column.
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] PrimaryKeyColumns(0) [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] DataColumn
PrimaryKeyColumns(0) = table.Columns([/SIZE][SIZE=2][COLOR=#800000]"id"[/COLOR][/SIZE][SIZE=2])
table.PrimaryKey = PrimaryKeyColumns
[/SIZE][SIZE=2][COLOR=#008000]' Create three new DataRow objects and add
[/COLOR][/SIZE][SIZE=2][COLOR=#008000]' them to the DataTable
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] i [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Integer
[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]For[/COLOR][/SIZE][SIZE=2] i = 0 [/SIZE][SIZE=2][COLOR=#0000ff]To[/COLOR][/SIZE][SIZE=2] 2[INDENT]row = table.NewRow()
row(
[/INDENT][/SIZE][INDENT][SIZE=2][COLOR=#800000]"id"[/COLOR][/SIZE][SIZE=2]) = i
row([/SIZE][SIZE=2][COLOR=#800000]"ParentItem"[/COLOR][/SIZE][SIZE=2]) = [/SIZE][SIZE=2][COLOR=#800000]"ParentItem "[/COLOR][/SIZE][SIZE=2] + i.ToString()
table.Rows.Add(row)
[/SIZE]
[/INDENT][SIZE=2][COLOR=#0000ff]Next[/COLOR][/SIZE][SIZE=2] i
table.WriteXml(Application.StartupPath & [/SIZE][SIZE=2][COLOR=#800000]"/myXML.xml"[/COLOR][/SIZE][SIZE=2])
[/SIZE]