combit List & Label 24 - .NET Online Web Help
AddCommand(IDbCommand,String,String,String) Method
Example 


combit.ListLabel24.DataProviders Namespace > DbCommandSetDataProvider Class > AddCommand Method : AddCommand(IDbCommand,String,String,String) Method

The command to add.

The name for the resulting table.

The delimiter format for the identifiers. SQL server and Oracle use double quotes as delimiters whereas Access uses square brackets. For these types, you don't need to actually pass the pattern as it is done automatically by using the AddCommand(IDbCommand,String) Method overload.

Server Delimiter format Sample
SQL/Oracle "{0}" SELECT * FROM "Customers"
Access [{0}] SELECT * FROM [Customers]
MySQL `{0}` SELECT * FROM `Customers`

 

Format string which should be used to format parameter names in generated SQL queries.

Server Parameter format
SQL/Oracle @{0}
Access ?{0}
MySQL ?{0}

For the .NET framework connection types, the correct format is automatically chosen, for your own custom provider you might need to adapt the format here.

 

Adds a command to the provider, resulting in an additional table in the Designer.

Syntax

Parameters

command

The command to add.

tableName

The name for the resulting table.

identifierDelimiterFormat

The delimiter format for the identifiers. SQL server and Oracle use double quotes as delimiters whereas Access uses square brackets. For these types, you don't need to actually pass the pattern as it is done automatically by using the AddCommand(IDbCommand,String) Method overload.

Server Delimiter format Sample
SQL/Oracle "{0}" SELECT * FROM "Customers"
Access [{0}] SELECT * FROM [Customers]
MySQL `{0}` SELECT * FROM `Customers`

 

parameterMarkerFormat

Format string which should be used to format parameter names in generated SQL queries.

Server Parameter format
SQL/Oracle @{0}
Access ?{0}
MySQL ?{0}

For the .NET framework connection types, the correct format is automatically chosen, for your own custom provider you might need to adapt the format here.

 

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 Vista - Windows 10 Version 1809, Windows Server 2008 - 2016

See Also

Reference

DbCommandSetDataProvider Class
DbCommandSetDataProvider Members
Overload List