Send feedback on this topic.
Teradata.Client.Provider
TdConnection Constructor(String)
Example 



Teradata.Client.Provider Namespace > TdConnection Class > TdConnection Constructor : TdConnection Constructor(String)
Identifies session attributes like User Id and Password.
Initializes a new instance of TdConnection given a connection string.
Syntax
'Declaration
 
Public Function New( _
   ByVal connectionString As String _
)
'Usage
 
Dim connectionString As String
 
Dim instance As New TdConnection(connectionString)
public TdConnection( 
   string connectionString
)
public:
TdConnection( 
   String^ connectionString
)

Parameters

connectionString
Identifies session attributes like User Id and Password.
Exceptions
ExceptionDescription
An invalid connection string is passed in. See TdDataReader for valid attribute names and values.
Remarks
A new instance of the TdConnection class is created. The input parameter connectionString is validated and properties such as TdConnection.Database and TdConnection.DataSource are set to the corresponding ConnectionString initial values.
Property Initial Value
ConnectionString Input parameter connectionString
ConnectionTimeout 20 or value supplied in connectionString
Database empty string or value supplied in connectionString
DataSource empty string or value supplied in connectionString
ServerVersion empty string
State System.Data.ConnectionState.Closed
Example
The following example creates an instance of the TdConnection class, sets the TdConnection.ConnectionString property and opens a connection to the Advanced SQL Engine.

public TdConnection CreateConnection()
{
    TdConnection cn = 
           new TdConnection(“Data Source=Teradata1;User Id=ab;Password=ab;”);
            
    cn.Open();
            
    return cn;
}
Requirements

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

See Also

Reference

TdConnection Class
TdConnection Members
Overload List