Joining Tables


Data can be selected from multiple tables by joining them together in the FromPart constructor parameter. If referencing a column name which appears in morte that one of the joined table the column expression will need to be qualified with the relevant table name.

DbNetGridCore ordersGrid = new DbNetGridCore("northwind", "Customers join Orders on Customers.CustomerID = Orders.CustomerID join [Order Details] on Orders.OrderID = [Order Details].OrderID");
ordersGrid.Columns = new List() { "Customers.CompanyName", "Orders.OrderDate", "[Order Details].OrderID", "[Order Details].ProductID", "[Order Details].UnitPrice", "[Order Details].Quantity", "Discount" };
ordersGrid.Labels = new List() { "Company Name", "Order Date", "Order ID", "Product", "Unit Price", "Qty", "Discount" };
ordersGrid.Column("ProductID").Lookup(new Lookup("Products", "ProductId", "ProductName"));