473,221 Members | 1,612 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,221 software developers and data experts.

Tables with relations in a Dataset?

I have a VB.NET application based on MS access 2000 db.

I have a 1 to many relation between 4 tables...

tbl1 -> tbl2 -> tbl3 -> tbl4 (all with "one to many" relations)

I need to create a Dataset that includes all these tables and keeps the
realtion

When I use an OLEdb Adapter and generate a dataset (in VS) based on that I
get all the tables' columns in one long dataset and the relations are all
gone.

How do I solve this?

/Lars
Nov 20 '05 #1
6 6509
Hi Lars,

I do not know if you use the join, however there is a bug in that.

http://support.microsoft.com/default...b;en-us;318646

I made a sample with relations for Access.

I hope that will help you a little bit?.
Cor
\\\\
Dim Sql As String = "SELECT * from A, B Where " & _
"A.n = B.n AND A.n = 10"
Dim Conn As New OleDbConnection(connString)
Dim da As New OleDbDataAdapter(Sql, Conn)
da.Fill(ds, "A")
da.Fill(ds, "B")
Conn.Close()
Dim drlA As New DataRelation _
("AA", ds.Tables("A").Columns("A.n"), _
ds.Tables("B").Columns("B.n"))
ds.Relations.Add(drlA)
Dim dv As New DataView(ds.Tables("A"))
DataGrid1.DataSource = dv
DataGrid1.Expand(-1)
ds.WriteXml("mypath", XmlWriteMode.WriteSchema)
End Sub
///
Nov 20 '05 #2
Can I use the XML file for something after doing this or why do you write
one in the example? Can I rename that one to a *.xsd extention and include
in the project and use somehow?

Also, the relation that shows up in the datagrid... I want to have each
table in the dataset in it's own datagrid.. is that possible?

/Lars


"Cor Ligthert" <no**********@planet.nl> skrev i meddelandet
news:eW**************@TK2MSFTNGP11.phx.gbl...
Hi Lars,

I do not know if you use the join, however there is a bug in that.

http://support.microsoft.com/default...b;en-us;318646

I made a sample with relations for Access.

I hope that will help you a little bit?.
Cor
\\\\
Dim Sql As String = "SELECT * from A, B Where " & _
"A.n = B.n AND A.n = 10"
Dim Conn As New OleDbConnection(connString)
Dim da As New OleDbDataAdapter(Sql, Conn)
da.Fill(ds, "A")
da.Fill(ds, "B")
Conn.Close()
Dim drlA As New DataRelation _
("AA", ds.Tables("A").Columns("A.n"), _
ds.Tables("B").Columns("B.n"))
ds.Relations.Add(drlA)
Dim dv As New DataView(ds.Tables("A"))
DataGrid1.DataSource = dv
DataGrid1.Expand(-1)
ds.WriteXml("mypath", XmlWriteMode.WriteSchema)
End Sub
///

Nov 20 '05 #3
Hi Lars,

I said it was a sample I had, in the XML file you can see the relations,

However do you have the resource kit.

With this and the samples for a Master-detail grid you should find
everything in my opinion.
(There are more samples for a Master detail grid in the resource kit)

http://msdn.microsoft.com/vbasic/vbrkit/default.aspx

And if you have problems installing it

http://msdn.microsoft.com/vbasic/vbr...q/#installvdir

I hope this helps a little bit?

Cor
Nov 20 '05 #4
Hi,

http://www.onteorasoftware.com/downloads/multigrids.zip

Ken
-------------------
"Lars Netzel" <la*********@qlogic.se> wrote in message
news:Oq**************@TK2MSFTNGP09.phx.gbl...
I have a VB.NET application based on MS access 2000 db.

I have a 1 to many relation between 4 tables...

tbl1 -> tbl2 -> tbl3 -> tbl4 (all with "one to many" relations)

I need to create a Dataset that includes all these tables and keeps the
realtion

When I use an OLEdb Adapter and generate a dataset (in VS) based on that I
get all the tables' columns in one long dataset and the relations are all
gone.

How do I solve this?

/Lars

Nov 20 '05 #5
Thank you!

/Lars

"Cor Ligthert" <no**********@planet.nl> skrev i meddelandet
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi Lars,

I said it was a sample I had, in the XML file you can see the relations,

However do you have the resource kit.

With this and the samples for a Master-detail grid you should find
everything in my opinion.
(There are more samples for a Master detail grid in the resource kit)

http://msdn.microsoft.com/vbasic/vbrkit/default.aspx

And if you have problems installing it

http://msdn.microsoft.com/vbasic/vbr...q/#installvdir

I hope this helps a little bit?

Cor

Nov 20 '05 #6
Thank you!

/Lars

"Cor Ligthert" <no**********@planet.nl> skrev i meddelandet
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi Lars,

I said it was a sample I had, in the XML file you can see the relations,

However do you have the resource kit.

With this and the samples for a Master-detail grid you should find
everything in my opinion.
(There are more samples for a Master detail grid in the resource kit)

http://msdn.microsoft.com/vbasic/vbrkit/default.aspx

And if you have problems installing it

http://msdn.microsoft.com/vbasic/vbr...q/#installvdir

I hope this helps a little bit?

Cor

Nov 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: bitwxtadpl | last post by:
-First I add and relate the tables A and B. Create a new instance of TableA Add TableA to DataSetX Create a new instance of TableB Add TableB to DataSetX Create a relation between TableA and...
4
by: Steve Klett | last post by:
(I posted this in ADO group, but I think this group will be better) Hi- I need to develop an FAQ section for our website. We would like to break up the FAQ by products, then categories with...
4
by: Joe Van Meer | last post by:
Hi, Is the datalist meant for one table or can I use it to display information from 2 different tables? Or should I be looking at a datagrid instead? I began my code and kinda ran into a snag...
2
by: Bennett Haselton | last post by:
I know how to create a DataAdapter that loads data from a data source into a table in a typed DataSet, and how to set the DataSource and DataMember properties of a DataGrid so that at run time it...
8
by: Jason L James | last post by:
Hi all, does anyone know if I can create a dataview from multiple datatables. My dataset is constructed from four separate tables and then the relationships are added that link the tables...
3
by: Bob | last post by:
I have a dataset with two tables. To make it simple, assume they are: Table_1 with EmployeeID, Name, and ReportsTo fields Table_2 with ManagerID and Name fields A data relation is set up...
2
by: yuanh23 | last post by:
Hi, I have 3 talbes "customers","orders","details". i wanna to use 3 datagrids to show those tables. and when the selected row in parent talbe changes, the selected row in child table changes...
6
by: Laura K | last post by:
This is probably a simple question but I want to make sure I am doing it right. I have a spoc with two select statements which results in two tables. Very Basic ...
2
by: Henrik | last post by:
Hi, I'm really stuck with this one. I have a dataset with two tables. One table is company data, and the other is contacts. I populate these by using a SP in SQL Server which returns the two...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.