Send feedback on this topic.
Teradata.Client.Provider
Clear Method (TdQueryBand)
Example 



Teradata.Client.Provider Namespace > TdQueryBand Class : Clear Method
Clears or removes all Query Bands from this instance of TdQueryBand.
Syntax
'Declaration
 
Public Sub Clear() 
'Usage
 
Dim instance As TdQueryBand
 
instance.Clear()
public void Clear()
public:
void Clear(); 
Remarks

In order to remove all the Query Bands that have been defined at the Connection level, the TdQueryBand object must be retrieved from TdConnection.QueryBand, and then Clear is called to clear all Query Bands from the instance of TdQueryBand. When the changes are applied by calling TdConnection.ChangeQueryBand, all of the Query Bands will be removed from the connection to Teradata.

When all Transaction level Query Bands need to be removed, an instance of TdQueryBand is retrieved from TdTransaction.QueryBand, and then Clear is called. The changes are applied to the Transaction when TdTransaction.ChangeQueryBand is called.

Example
The following is an example of how to clear the Query Bands from a connection.
static public void ClearQueryBandExample()
{
    TdConnection conn = new TdConnection(
       @"DataSource=teradata1;UserId=user1;Password=password1;QueryBand='ProxyUser=user1;ApplicationName=app1'");
            
    // The Query Bands specified using the QueryBand connection string attribute 
    // are defined at the Connection level. 
    conn.Open();
            
    // Retrieving the Query Bands from the connection 
    TdQueryBand qb = conn.QueryBand;
            
    // Currently the ProxyUser and ApplicationName are the Query Bands
    // defined on the connection
            
    // Removing all Query Bands from the TdQueryBand instance    
    qb.Clear();
            
    // Removing all the Query Bands defined on the connection to Teradata
    conn.QueryBand = qb;
            
    // 
    // Application continue performing its tasks
    //
            
    conn.Close();
}
Requirements

Target Platforms: Windows 8.1, Windows 10, Windows Server 2012 R2, Windows Server 2016, Windows Server 2019

See Also

Reference

TdQueryBand Class
TdQueryBand Members