Create a CompositeCommand Object

The following sections provide code samples for how to select or update data from a published TDV resource. You can use multiple programmatic styles to access, use, and change the data.

Using a SQL Statement to Create the CompositeCommand Object
Using the conn.CreateCommand Method to Create the CompositeCommand Object
Using CompositeCommand to Create the CompositeCommand Object

Using a SQL Statement to Create the CompositeCommand Object

The following builds a CompositeCommand object with a SQL statement and the CompositeConnection object.

try
{
	String sql = "delete from products where ProductID=1111";
   CompositeCommand cmd = new CompositeCommand(sql, conn);
}
catch (Exception ex)
{
	Throw ex;
}

Using the conn.CreateCommand Method to Create the CompositeCommand Object

The following retrieves a CompositeCommand object by calling the conn.CreateCommand method. Set the SQL statement to cmd before using it to access TDV.

try
{
	CompositeCommand cmd = conn.CreateCommand(); 
	cmd.CommandText = "delete from products where ProductID=1111";
}
catch (Exception ex)
{
	Throw ex;
}

Using CompositeCommand to Create the CompositeCommand Object

Use the following to create a new object. Call the CompositeCommand default constructor and set the CommandText and Connection objects before using it.

try
{
	CompositeCommand cmd = new CompositeCommand(); 
	cmd.CommandText = "delete from products where ProductID=1111";
	cmd.Connection=conn;
}
catch (Exception ex)
{
	Throw ex;
}