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 8832005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:26:03+00:00 2026-06-14T08:26:03+00:00

I search a way to simulate a database and link between table. sample: Table

  • 0

I search a way to simulate a database and link between table.

sample:

Table A
colA

And

Table B
colB
colD

linked by

Table C
colA
colB

and

Table D
colD

That made TableA linked to TableB by TableC.
And tableD linked to tableB.

what I think to do its a kind of linkedlist.

a little like :

Class Table
    Private cols As List(Of Column)
End Class

Public Delegate Sub TableDelegate(ByVal tbl As Table)

Class Column
    Private name As String 'use for column name like colA,colB....

    Private fk As List(Of TableDelegate) 'linked foreign key
End Class

I never work with delegate, I usely do this in pointer, but I’m stuck in vb.

So its a beginning, if you have idea where to go or a complete other way to do it?

tank you

  • 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-14T08:26:04+00:00Added an answer on June 14, 2026 at 8:26 am
    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
      'Table A'
      Dim dtbA As New DataTable("TableA")
      dtbA.Columns.Add(New DataColumn("ColA", GetType(String)))
      dtbA.PrimaryKey = {dtbA.Columns("ColA")}
      'Table B'
      Dim dtbB As New DataTable("TableB")
      dtbB.Columns.Add(New DataColumn("ColB", GetType(String)))
      dtbB.Columns.Add(New DataColumn("ColD", GetType(String)))
      dtbB.PrimaryKey = {dtbB.Columns("ColB")}
      'Table C'
      Dim dtbC As New DataTable("TableC")
      dtbC.Columns.Add(New DataColumn("ColA", GetType(String)))
      dtbC.Columns.Add(New DataColumn("ColB", GetType(String)))
      dtbC.PrimaryKey = {dtbC.Columns("ColA"), dtbC.Columns("ColB")}
      'Table D'
      Dim dtbD As New DataTable("TableD")
      dtbD.Columns.Add(New DataColumn("ColD", GetType(String)))
      'Dataset'
      Dim dst As New DataSet("MyDataset")
      dst.Tables.Add(dtbA)
      dst.Tables.Add(dtbB)
      dst.Tables.Add(dtbC)
      dst.Tables.Add(dtbD)
      dst.Relations.Add(New DataRelation("AC", dtbA.Columns("ColA"), dtbC.Columns("ColA"), True))
      dst.Relations.Add(New DataRelation("BC", dtbB.Columns("ColB"), dtbC.Columns("ColB"), True))
      dst.Relations.Add(New DataRelation("BD", dtbB.Columns("ColD"), dtbD.Columns("ColD"), True))
      'now add data'
      dst.Tables("TableA").Rows.Add("AA1")
      dst.Tables("TableA").Rows.Add("AA2")
      dst.Tables("TableA").Rows.Add("AA3")
      dst.Tables("TableB").Rows.Add("BB1", "DD1")
      dst.Tables("TableB").Rows.Add("BB2", "DD2")
      dst.Tables("TableB").Rows.Add("BB3", "DD3")
      dst.Tables("TableC").Rows.Add("AA1", "BB1")
      dst.Tables("TableC").Rows.Add("AA2", "BB2")
      dst.Tables("TableC").Rows.Add("AA3", "BB3")
      dst.Tables("TableD").Rows.Add("DD1")
      dst.Tables("TableD").Rows.Add("DD2")
      dst.Tables("TableD").Rows.Add("DD3")
      'query the data'
      Dim s As String = ""
      For Each drwA As DataRow In dst.Tables("TableA").Rows
        s &= "TableA:" & drwA("ColA").ToString & vbCrLf
        Dim drwC As DataRow = drwA.GetChildRows(dst.Relations("AC"))(0)
        s &= "--TableC:" & drwC("ColA").ToString() & drwC("ColB").ToString() & vbCrLf
        Dim drwB As DataRow = drwC.GetParentRow(dst.Relations("BC"))
        s &= "--TableB:" & drwB("ColB").ToString() & drwB("ColD").ToString() & vbCrLf
        Dim drwD As DataRow = drwB.GetChildRows(dst.Relations("BD"))(0)
        s &= "--TableD:" & drwD("ColD").ToString() & vbCrLf
      Next
      MsgBox(s)
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a way to search on www.qantas.com.au or other sites that don't use
I'm looking for a way to search a file system that contains approximately 1TB
Is there a way to search in a database a custom string and replace
I have a question that if Perform search in way that i have given
I search a way to create query by using a dataset as database simulator.
What's the easiest way to search a div for a text string using jquery?
Is there a reasonable way to search standards for programming and markup languages (specifically,
Is there a way to search for a file in a subversion repository? Something
Is there a way to search and eventually search and replace text in Visual
Is there a way to search, from a string, a line containing another string

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.