Data relations are used like below
dstInvoicesAndDetails.Tables.Add(tblInvoices);
dstInvoicesAndDetails.Tables.Add(tblInvoiceDetails );
drlInvoicesAndDetails = new DataRelation("InvoicesAndDetials",
tblInvoices.Columns["invoice"], tblInvoiceDetails.Columns["invoice"]);
dstInvoicesAndDetails.Relations.Add(drlInvoicesAnd Details);
It adds two DataTables to a data set, The master table, Invoices, which
just contains invoice number date, customer code etc. and invoice details
which contains the products, price, qty on the invoice along with the realted
invoice number.
then a command like
DataRow[]
drwInvoiceDetailsSubset=tblInvoices.Rows[1].GetChilRows(drlInvoicesAndDetails);
would return an array of datarow objects (ie. rows) that that represent the
invoice details records for row 1 in the invoice table. The datarow array
can then be bound to a control.
"Carlos Albert" wrote:
Hello everybody,
I'm using some gridviews with datalists inside template columns.
Now, for each datalist I'm calling a method returning a dataset (depending
from a column from the gridview).
But I was wondering: is there a way to bring just one DataSet with two
related tables and apply the "child" table to the datalist?
I didn't find some examples of how to use DataRelations, so if anybody could
give me a hint... =/
Tnx!!!