combit List & Label 25 - .NET Online Web Help
AddRelation(String,String,String,String,String) Method


combit.ListLabel25.DataProviders Namespace > DbCommandSetDataProvider Class > AddRelation Method : AddRelation(String,String,String,String,String) Method

Name for the relation. May appear in the UI if multiple relations exist between the same two tables.

Name of the parent table.

Name of the child table.

Column name of the parent table. See remark section for composite key fields.

Column name of the child table. See remark section for composite key fields.

Adds a relation between two commands/tables.

Syntax

Parameters

relationName

Name for the relation. May appear in the UI if multiple relations exist between the same two tables.

parentTableName

Name of the parent table.

childTableName

Name of the child table.

parentColumnName

Column name of the parent table. See remark section for composite key fields.

childColumnName

Column name of the child table. See remark section for composite key fields.

Remarks

To support composite primary keys (the primary key of each table consists of two or more columns) for the relation, you can simple separate the individual column names by tab character '\t' for the parameters parentColumName and childColumnName.

Example
OleDbCommand command = new OleDbCommand("Select * from [Customers]", conn);
OleDbCommand command2 = new OleDbCommand("Select * from [Orders]", conn);

DbCommandSetDataProvider provider = new DbCommandSetDataProvider();
provider.AddCommand(command, "Customers");
provider.AddCommand(command2, "Orders");
provider.AddRelation("Customers2Orders", "Customers", "Orders", "CustomerID", "CustomerID");

LL.DataSource = provider;
LL.Design();
Dim command As New OleDbCommand("Select * from [Customers]", conn)
Dim command2 As New OleDbCommand("Select * from [Orders]", conn)

Dim provider As New DbCommandSetDataProvider()
provider.AddCommand(command, "Customers")
provider.AddCommand(command2, "Orders")
provider.AddRelation("Customers2Orders", "Customers", "Orders", "CustomerID", "CustomerID")

LL.DataSource = provider
LL.Design()

Requirements

Platforms: Windows 7 SP1 - Windows 10 Version 1909, Windows Server 2008 R2 - 2019

See Also

Reference

DbCommandSetDataProvider Class
DbCommandSetDataProvider Members
Overload List