Disconnected DataSets and DataViews

G

garethdjames

For scalability we wish to use disconnected DataSets and hold them in
the application cache.

This means that multiple concurrent users will be reading the data (its
read only)

The DataSet is fairly complicated and contains many tables and many
relationships

What we would like to do is create a DataView that flattens the in
memory DataSet so that we can bind this single view to a control

We need to hold the separate tables in memory because there are some
tables that have parent child relationships where the parent has many
thousands of children (and grand children)

think Products and Orders and we want to hold Products and Orders in
Memory, the reason is that each Product row is large enough not to
warrant holding it multiple times

OK, the problem is that a DataView can only have one table and the row
filter can only be for that table,

what we want to do is an equivalent of a sql select (with a join) but
from disconnected a DataSet

e.g.

Select Product.ID, Product.Code, Product.Image, Order.FirstName,
Order.Price
from tbl_Product PRoduct
join tbl_Order Order
on Order.ProductID = Product.ID

Any help would be appreciated
 
M

Miha Markic [MVP C#]

Hi There,

You migh try using expression columns (see DataColumn.Expression)
or
you might create your own implementation of DataView on the top of the
dataset. You just need to return items (item contain wrapper properties to
datarows) based on a select parameter.
 
C

Cor Ligthert [MVP]

Gareth,

The answer is very simple, as I understand you well, than you cannot do
that.

The dataview is in fact just a property from a datatable (the defaultview),
that you can clone for use with more datafilters and sorts.

However probably do you need per user another datarowfilter (this can be
used to get a selected dataset accoording to the master relation)

Maybe gives this your answer.

Cor
 
E

Earl

After you create your data relations, add the child and grandchild columns
to your main datatable, then create your dataview.

relSuppliers = New DataRelation("CityStateZipSupplier", _
dsSup.Tables("dtSupplierZips").Columns("ZipCityStateID"), _
dsSup.Tables("dtSuppliers").Columns("SupplierZipCityID"), False)

dsSup.Relations.Add(relSuppliers)

dsSup.Tables("dtSuppliers").Columns.Add("City", GetType(String),
"Parent(CityStateZipSupplier).City")
....
Dim dv As New DataView(dtSuppliers)
 
A

Adrian Moore

Hi

You might be interested in the assembly I've been working on. Besides INNER
JOINS, it lets you perform complex SQL SELECT statements including UNION,
OUTER JOINS, GROUP BY, HAVING, ORDER BY, sub-queries, etc against the tables
in a dataset. The result of the query is a DataView.

Adrian Moore
http://www.queryadataset.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top