Re: DataRelations and DataGrids
From: Sijin Joseph (sijinNOSPAMdotnet_at_hotmail.com)
Date: 09/21/04
- Next message: Sijin Joseph: "Re: Main Thread is lost after an event is fired"
- Previous message: Sijin Joseph: "Re: datagrid select vs currentRowIndex"
- In reply to: aualias: "DataRelations and DataGrids"
- Next in thread: aualias: "Re: DataRelations and DataGrids"
- Reply: aualias: "Re: DataRelations and DataGrids"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 21 Sep 2004 09:25:00 +0530
Hi,
Yes you can use a DataRelation for this purpose, you will need to define
a DataRelation between your parent tables and child tables and then use
the DataColumn.Expression property to set the value to the
ParentRelations relevant field.
This is the relevant documentation from the MSDN documentation of
DataColumn.Expression property
PARENT/CHILD RELATION REFERENCING
A parent table may be referenced in an expression by prepending the
column name with Parent. For example, the Parent.Price references the
parent table's column named Price.
A column in a child table may be referenced in an expression by
prepending the column name with Child. However, because child
relationships may return multiple rows, you must include the reference
to the child column in an aggregate function. For example,
Sum(Child.Price) would return the sum of the column named Price in the
child table.
If a table has more than one child, the syntax is: Child(RelationName).
For example, if a table has two child tables named Customers and Orders,
and the DataRelation object is named Customers2Orders, the reference
would be:
Avg(Child(Customers2Orders).Quantity)
Also check out these articles
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskcreatinglookuptableforlistboxorcomboboxcontrol.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbwlkCreatingLookupTableOnData-BoundWindowsForm.asp
Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph
aualias wrote:
> I have tables Junk and JunkLookup in a DataSet. Junk has an integer field
> junkType, which is a primary key into JunkLookup.
>
> Can I bind to Junk and use a DataRelation to display and update data in a
> DataGrid?
> Is it better to do a join in the SQL?
>
> Ideally, I would like to copy the database relationships in the DataSet that
> I use on the client.
>
> Thanks.
>
> Alfredo
>
>
>
- Next message: Sijin Joseph: "Re: Main Thread is lost after an event is fired"
- Previous message: Sijin Joseph: "Re: datagrid select vs currentRowIndex"
- In reply to: aualias: "DataRelations and DataGrids"
- Next in thread: aualias: "Re: DataRelations and DataGrids"
- Reply: aualias: "Re: DataRelations and DataGrids"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|