all groups > dotnet academic > december 2003 >
You're in the

dotnet academic

group:

Getting parent/child relations from data table to string?


Getting parent/child relations from data table to string? What-a-Tool
12/1/2003 9:34:12 PM
dotnet academic:
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)

Re: Getting parent/child relations from data table to string? What-a-Tool
12/2/2003 9:10:21 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_Constraints, 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@lakeread05...
[quoted text, click to view]

Re: Getting parent/child relations from data table to string? What-a-Tool
12/3/2003 6:32:53 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_Constraints, 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@lakeread05...
[quoted text, click to view]

AddThis Social Bookmark Button