Re: Related column values
From: Nicolas L. (jnlinale_at_yahoo.com)
Date: 12/20/04
- Next message: Nicolas L.: "GridLineStyle"
- Previous message: Keith: "display ocx without AxHost"
- In reply to: Oleg Ogurok: "Related column values"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 20 Dec 2004 03:40:23 -0300
Users table is in a relation 1-to-many with Orders, so if you want to add
First and Last Name of Users to Orders,
you could add one more DataColumn to table Orders and set the expression to:
Dim dcFullName As DataColumn
' Create the column.
dcFullName = New DataColumn
With dcFullName
.DataType = System.Type.GetType("System.String")
.ColumnName = "FullName"
.Expression = "Parent.FirstName + Parent.LastName"
End With
myDataSet.Table("Orders").Columns.Add(dcFullName)
Don't forget to include the "Parent." in the expression because you're
referring a parent table from its child, to refer a child from its parent
you must antepone "Child." to the column name. For a complete use of
DataColumn.Expression Property go to:
Nicolas L.
"Oleg Ogurok" <oleg@ogurok.com.ihatespammers.ireallydo.co> escribió en el
mensaje news:10s9v62sn0r55b4@corp.supernews.com...
> Hi all,
>
> I have a strongly typed dataset with tables:
> Users: ID, First Name, LastName
> Orders: ID, Quantity, UserID
>
> UserID is related to Users' ID column via a DataRelation.
>
> I'm binding Orders table to a DataGrid, and one of the columns I need to
> be
> the First+Last name of the corresponding user.
> How can I accomplish it?
>
> Also, if I need to filter the orders by UserID, can I use DataView in my
> scenario?
>
> I tried adding a DataGridColumnStyle and setting MappingProperty to bunch
> of
> different values but none worked.
>
> Also, any examples, tutorials on DataGrid are gladly appreciated.
> Thanks.
> -Oleg.
>
>
>
>
- Next message: Nicolas L.: "GridLineStyle"
- Previous message: Keith: "display ocx without AxHost"
- In reply to: Oleg Ogurok: "Related column values"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|