473,402 Members | 2,072 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,402 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 6516
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.