Hacer Joins entre DataTables

0
752
[VB.NET]

'Creamos el Dataset
Dim ds as new DataSet()

'Agregamos las ralaciones
ds.Relations.Add("Customers_Orders",
ds.Tables("Customers").Columns("CustomerID"),
ds.Tables("Orders").Columns("CustomerID")

'Otra relación
ds.Relations.Add("Orders_Products",
ds.Tables("Orders").Columns("ProductID"),
ds.Tables("Products").Columns("ProductID")

ds.Relations("Customer_Orders").Nested = true
ds.Relations("Orders_Products").Nested = true
[C#.NET]

DataSet ds = new DataSet();
ds.Relations.Add("Customers_Orders", 
ds.Tables("Customers").Columns("CustomerID"), 
ds.Tables("Orders").Columns("CustomerID"));

ds.Relations.Add("Orders_Products", 
ds.Tables("Orders").Columns("ProductID"), 
ds.Tables("Products").Columns("ProductID"));

ds.Relations("Customer_Orders").Nested = true;
ds.Relations("Orders_Products").Nested = true;

Fuente Foros del Web

Dejar respuesta

Please enter your comment!
Please enter your name here

Protected with IP Blacklist CloudIP Blacklist Cloud