HighTechTalks DotNet Forums  

Getting parent/child relations from data table to string?

Dotnet Academic General Discussions microsoft.public.dotnet.academic


Discuss Getting parent/child relations from data table to string? in the Dotnet Academic General Discussions forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
What-a-Tool
 
Posts: n/a

Default Getting parent/child relations from data table to string? - 12-01-2003 , 09:34 PM






I am trying to write a program that will take all the members of a data
base, add them to a tree, with all child relations as sub-nodes.

I am having a problem getting the parent child relations for each table &
query.


Dim tblCurrent As DataTable
Dim strTableName As string
For Each tblCurrent In Ds1.Tables
strTableName = tblCurrent.TableName.ToString
Next

This gives me my table names. I can also get column names the same way.

..GetXMLSchema shows me what I want, but I don't want to even think about
dissecting that string data to make it usefull to me.

How can I get the name of any parent or child tables for tblCurrent?


--
Thanks in advance for any help

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)



Reply With Quote
  #2  
Old   
What-a-Tool
 
Posts: n/a

Default Re: Getting parent/child relations from data table to string? - 12-02-2003 , 09:10 PM






I tried the following, but get an "invalid cast exception" on the "dt =
Con.GetOleDbSchemaTable..." line.

I'm using an Access DB.

Can anyone tell me whats wrong here? Thanks in Advance



///

Dim dt As New DataTable()

Ds1.Tables.Add(dt)

dt = Con.GetOleDbSchemaTable(OleDbSchemaGuid.Table_Cons traints, New
Object())

Dim f As New frmDG()

f.dg1.DataSource = dt

f.ShowDialog()

\\\


--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

"What-a-Tool" <Die!FrigginSpammersDieDie!@NoShitSherlock.Net> wrote in
message news:wSSyb.7288$Yt4.4568 (AT) lakeread05 (DOT) ..
Quote:
I am trying to write a program that will take all the members of a data
base, add them to a tree, with all child relations as sub-nodes.

I am having a problem getting the parent child relations for each table &
query.


Dim tblCurrent As DataTable
Dim strTableName As string
For Each tblCurrent In Ds1.Tables
strTableName = tblCurrent.TableName.ToString
Next

This gives me my table names. I can also get column names the same way.

.GetXMLSchema shows me what I want, but I don't want to even think about
dissecting that string data to make it usefull to me.

How can I get the name of any parent or child tables for tblCurrent?


--
Thanks in advance for any help

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)





Reply With Quote
  #3  
Old   
What-a-Tool
 
Posts: n/a

Default Re: Getting parent/child relations from data table to string? - 12-03-2003 , 06:32 AM



Incase anyone is interested, this is what worked and gave me a data grid
filled with my constraints.

Dim dt As New DataTable()

DsNew.Tables.Add(dt)

Con.Open()

dt = Con.GetOleDbSchemaTable(OleDbSchemaGuid.Table_Cons traints, New Object()
{})

Con.Close()

Dim f As New frmDG()

f.dg1.DataSource = dt

f.ShowDialog()



Had to add the {} after new object to make it an array of objects. Solution
supplied by a very helpful person on ADO.Net group


--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

"What-a-Tool" <Die!FrigginSpammersDieDie!@NoShitSherlock.Net> wrote in
message news:7Cbzb.7684$Yt4.7073 (AT) lakeread05 (DOT) ..
Quote:
I tried the following, but get an "invalid cast exception" on the "dt =
Con.GetOleDbSchemaTable..." line.

I'm using an Access DB.

Can anyone tell me whats wrong here? Thanks in Advance



///

Dim dt As New DataTable()

Ds1.Tables.Add(dt)

dt = Con.GetOleDbSchemaTable(OleDbSchemaGuid.Table_Cons traints, New
Object())

Dim f As New frmDG()

f.dg1.DataSource = dt

f.ShowDialog()

\\\


--

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)

"What-a-Tool" <Die!FrigginSpammersDieDie!@NoShitSherlock.Net> wrote in
message news:wSSyb.7288$Yt4.4568 (AT) lakeread05 (DOT) ..
I am trying to write a program that will take all the members of a data
base, add them to a tree, with all child relations as sub-nodes.

I am having a problem getting the parent child relations for each table
&
query.


Dim tblCurrent As DataTable
Dim strTableName As string
For Each tblCurrent In Ds1.Tables
strTableName = tblCurrent.TableName.ToString
Next

This gives me my table names. I can also get column names the same way.

.GetXMLSchema shows me what I want, but I don't want to even think about
dissecting that string data to make it usefull to me.

How can I get the name of any parent or child tables for tblCurrent?


--
Thanks in advance for any help

/ Sean the Mc /


"I have not failed. I've just found 10,000 ways that won't work."
- Thomas Alva Edison (1847-1931)







Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.