Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7969773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:17:22+00:00 2026-06-04T07:17:22+00:00

Dim obj_DataTable As New System.Data.DataTable(Category) Dim obj_DataSet As New DataSet() ‘Declaring the array of

  • 0
Dim obj_DataTable As New System.Data.DataTable("Category")
    Dim obj_DataSet As New DataSet()
    'Declaring the array of DataColum to hold the Primary Key Columns
    Dim obj_PrimaryClmn(1) As System.Data.DataColumn
    Dim obj_DataRow As System.Data.DataRow
    Dim obj_DataRelation As DataRelation
    Dim writer As New System.IO.StringWriter

    obj_DataTable.Columns.Add(New System.Data.DataColumn("CategoryId"))
    obj_DataTable.Columns.Add(New System.Data.DataColumn("CategoryName"))

    obj_PrimaryClmn(0) = obj_DataTable.Columns(0)
    'Assigning the CategoryId column as Primary Key
    obj_DataTable.PrimaryKey = obj_PrimaryClmn

    'Entering the data in Category Table
    obj_DataRow = obj_DataTable.NewRow()
    obj_DataRow.Item(0) = 0
    obj_DataRow.Item(1) = "Select Category"
    obj_DataTable.Rows.Add(obj_DataRow)

    obj_DataRow = obj_DataTable.NewRow()
    obj_DataRow.Item(0) = 1
    obj_DataRow.Item(1) = "Computers"
    obj_DataTable.Rows.Add(obj_DataRow)

    obj_DataSet.Tables.Add(obj_DataTable)

    obj_DataTable.PrimaryKey = obj_PrimaryClmn

    Dim obj_DataRow1 As System.Data.DataRow
    Dim obj_DataTable1 As New System.Data.DataTable("Product")

    obj_DataTable1.Columns.Add(New System.Data.DataColumn("ProductId"))
    obj_DataTable1.Columns.Add(New System.Data.DataColumn("ProductName"))
    obj_DataTable1.Columns.Add(New System.Data.DataColumn("CategoryId"))

    obj_DataRow1 = obj_DataTable1.NewRow()
    obj_DataRow1.Item(0) = 1
    obj_DataRow1.Item(1) = "PHP"
    obj_DataRow1.Item(2) = 1
    obj_DataTable1.Rows.Add(obj_DataRow1)

    obj_DataSet.Tables.Add(obj_DataTable1)

    Dim obj_ParentClmn, obj_ChildClmn As DataColumn

    obj_ParentClmn = obj_DataSet.Tables("Category").Columns("CategoryId")
    obj_ChildClmn = obj_DataSet.Tables("Product").Columns("CategoryId")

    obj_DataRelation = New DataRelation("relation_Category_Product", obj_ParentClmn, obj_ChildClmn)

    obj_DataSet.Relations.Add(obj_DataRelation)

    obj_DataSet.WriteXml(writer)

    MsgBox(writer.ToString())

This code executes. There is a relation between parent and child tables. This code first displays xml from first and xml from the second table one after the other. I don’t need this way. Because relation is there the xml should display first table in xml and its second table as a child node of first table. How can it be possible? Please help me out.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T07:17:23+00:00Added an answer on June 4, 2026 at 7:17 am

    Set the Relation Type to Nested as per below code, it will populate child table as subnodes in XML.

    obj_DataRelation = New DataRelation("relation_Category_Product", obj_ParentClmn, obj_ChildClmn)
    obj_DataRelation.Nested = True
    obj_DataSet.Relations.Add(obj_DataRelation)
    

    Refer here to know more about nesting of nodes, great knowledge

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Dim objMail As New Mail.MailMessage(no-reply@mywebsite.com, ToEmail, Password Reset, body) ...and the problem is that
Consider: Dim line As String Using readFile As New StreamReader(SalesUpdateFile) While (line = readFile.ReadLine)
I'm changing old, vulnerable SqlCommands with SqlParameters but get a SqlException: System.Data.SqlClient.SqlException {Conversion failed
i have some Objects serialized with the System.Runtime.Serialization.Json.DataContractJsonSerializer and written to my Database: Dim
Dim sb As StringBuilder = New StringBuilder() sb.Append(<script language=javascript>) sb.Append( function SetValueInBody() {) sb.Append(
I have created a sample form as Dim obj_CommonForm As New Form Dim btn_Create
web method: <WebMethod()> Public Shared Function Pcpacking() As IEnumerable(Of Packing) Dim db As New
Dim classCodeDetails As List(Of ClassCodeDetail) = db.ClassCodeHeaders.Single(Function(cch) cch.CLCH_ID = classCodeHeaderId ).ClassCodeDetails.ToList() classCodeDetails.Sort(Function(c1, c2) c1.Make.MAKE_English.CompareTo(c2.Make.MAKE_English)
Dim xbg As Rm xbg.LobId = cmb_lob.SelectedValue xbg.Mobile = mobno.Text xbg.BusinessFax = faxno.Text xbg.BusinessPhone
Dim MyQuery = From c In xdoc.Descendants() _ Where c.Attribute(OriginY) IsNot Nothing _ Order

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.