The assembly (Teradata.Client.VS.dll) exposes the .NET Data Provider for Teradata objects necessary for development of ADO.NET applications utilizing the Advanced SQL Engine within Microsoft Visual Studio 2015-2019 (Copyright (c) Microsoft Corporation. All Rights Reserved).
The integration with Microsoft Visual Studio includes the following features:
Server Explorer enables viewing and retrieval of information from a database:
Creation of a data connection configured to support Teradata
Teradata data connection nodes support database Tables, Views, Stored Procedures, Macros, User Defined Functions and User Defined Types
Expansion of tables to list Columns, Keys (Foreign, Unique and Primary) and Indexes
Expansion of views to list Columns
Expansion of Stored Procedures and Macros to list Stored Procedure Parameters and Macro Parameters
Expansion of User Defined Functions to list User Defined Function Parameters
Hierarchal display of data connections selectable as a classic view of objects organized by type or a view by database where objects are displayed hierarchal by database
Changing passwords from open data connections as a new menu item in Visual Studio.
Changing a password in response to an expiration of the password by Teradata is supported during opening data connections
Visual Studio menu items to support original Data Definition Language (DDL) display of database objects - Tables, Views, Stored Procedures and Macros
Visual Studio menu items to support original DDL display of database objects - User Defined Functions, User Defined Types, Hash Indexes and Join Indexes
Beginning in Teradata database release 12.0, Server Explorer data connections may experience a performance degradation. For more information on this performance degradation and recommendations please see Teradata XView performance considerations.
For further information on Server Explorer please see:
Server Explorer/Database Explorer
How to: Add New Data Connections in Server Explorer/Database Explorer
Right-clicking the Teradata data connection (within Server Explorer) supports Query Designer through the menu item -> New Query. Query Designer is a graphical tool that displays tables and views utilized to select columns in building database queries.
For further information on Query Designer please see:
Visual Studio 2005 Toolbox displays icons from a list of supported items, available from the View menu. Each Toolbox icon may be dragged and dropped onto a design surface, adding the necessary code to create an instance of the object.
The .NET Data Provider for Teradata objects - TdConnection, TdCommand, TdCommandBuilder and TdDataAdapter are available items following the installation of the .NET Data Provider for Teradata.
Toolbox must be configured to include .NET Data Provider for Teradata objects in the Toolbox. To enable the Toolbox display, Visual Studio 2005 menu item View -> Toolbox must be selected. Right clicking any Toolbox group and selecting Choose Items, enables customization of the Toolbox.
Select the .NET Framework Components tab and select the Namespace to sort components. Enable the TdCommand, TdConnection, TdCommandBuilder and TdDataAdapter .NET Data Provider for Teradata components found in the Teradata.Client.Provider namespace.
For further information on Visual Studio Toolbox please see ->
Teradata data provider objects, TdConnection, TdCommand, TdCommandBuilder and TdDataAdapter may be dragged from the Visual Studio Toolbox and dropped onto the Windows Form. Code to support these objects is automatically generated to create an instantiation of the object.
TdConnection: Set the connection properties as described in TdConnection.ConnectionString documentation. The connection string is a required property.
TdCommand: Set the command properties, including the connection and command text. Clicking on the TdCommand object will display a smart tag, which contains one item – Preview Data. Click on the smart tag, Preview Data to execute the defined query.
Preview Data – This tag executes the commands defined in the DataAdapter (during configuration) and displays the data in a Dataset.
TdCommandBuilder – Set the DataAdapter property to a predefined TdDataAdapter.
For further information on Windows Forms development please see:
Datasets, in-memory copies of relational table data and their relationships from supported data sources, are supported in Windows Form projects through right-clicking data sources (Edit Dataset). Creation and population of Datasets are supported through the Teradata TdDataAdapter.
The Data Source pane may be enabled by selecting from the Data menu item available in a Windows Form Project the item – Show Data Sources or Add New Data Source.
Creating a data source will also define a Dataset in which the data source is linked. The Data Source pane displays the Dataset generated during the data source configuration. Right click the Dataset to display Dataset Designer options:
Add a New Data Source – Creates another data source.
Edit Dataset with Designer – This visual designer tool connects to the defined SQL Engine and enables tables, views and columns to be selected from a database to create a Dataset.
Configure Dataset with Wizard – A wizard generates the Dataset.
Refresh – Refresh the Dataset.
Preview Data – Execute the command to populate the Dataset.
For further information on Dataset Designer please see:
ASP.NET applications and Windows Forms applications may create read/write links from application controls with the SQL Engine. Data binding enables controls to retrieve and update Teradata relational data. Data binding enables controls on a Windows Form to populate from a relational database. A summary of the steps to create a data binding to a Teradata table or view follows:
Create a data source within a Windows Form project. The Data Source pane may be enabled by selecting from the Data menu item available in a Windows Form Project the item – Show Data Sources or Add New Data Source.
Select the Toolbox -> Data group, drag and drop a BindingSource object onto the Windows Form. In the BindingSource properties, set the DataSource property to the Data Source created earlier.
Select a control from the Toolbox, such as a ListBox or a DataGrid and drop the control onto the Windows Form. Configure the control by selecting the smart tag on the object.
Preview the control to validate proper configuration. The application may be debugged to view the control and the data binding to the Teradata tables.
For further information on data binding please see:
SQL Server Analysis Services supports Visual Studio integration through a new class of Business Intelligence projects. An Analysis Services project template supports SQL Server Analysis Services. The following features are supported:
Data connections to Teradata may be defined.
Data views utilizing Teradata data connections may be defined which determine the tables and views supported in building metadata cubes.
Metadata cubes may be generated through definition of fact and dimension tables, and the selected measures and dimensions from those tables. Any foreign key relationships must be established between tables, and primary keys must be selected for each fact or dimension table as a requirement prior to generating the metadata cube.
For further information on Microsoft SQL Server Analysis Services please see:
SQL Server Analysis Services (SSAS)
Microsoft Visual Studio 2005 supports Generated Data Retrieval through configuration of the TdDataAdapter in Windows Form Projects. TableAdapters provide communication between your application and a database. A TableAdapter connects to the database and is responsible for executing queries against the database to populate DataTables and to provide synchronization between the DataTable and the database table.
Configuration of the TdDataAdapter in Form Designer - Microsoft Visual Studio 2005 Windows projects may configure the TdDataAdapter by dragging and dropping the TdDataAdapter from the Visual Studio Toolbox onto a Windows Form. The Toolbox must be initialized with the .NET Data Provider for Teradata (current version) components before dragging and dropping the TdDataAdapter from the Toolbox onto the Windows Form. An icon will appear below the Windows Form. Selecting the TdDataAdapter from the bottom of the Windows Form Designer will display a designer arrow above the TdDataAdapter.
Selecting this arrow and selecting the Configure Data Adapter will enable configuration of the DataAdapter. Please follow the configuration wizard instructions to generate the appropriate commands. Delete and Update commands will only be generated against database tables/views that contain primary keys. After configuration is complete, select the properties of the TdDataAdapter displaying the properties in the property window. Select the insert command property GeneratedDataBehavior and use the drop down list box to select either IdentityColumn or AllColumns. This will enable the defined DataTable to update column values from insert or insert-select statement types executed against the database table.
Configuration of the TdDataAdapter in Dataset Designer - The TdDataAdapter may also be configured utilizing the DataAdapter configuration wizard in the Typed Dataset Designer. A Data Source may be defined by selecting tables or views from Teradata in the Data Sources view. Selecting the Data Source Add a New Data Source button will enable the Data Source configuration wizard. Follow the instructions defining a Teradata Data Source. This will create a Dataset that contains a TableAdapter with generated commands to support your selected database object. Remember that the update and delete commands will only be generated for database tables/views that contain a primary key.
The Configuration of the Data Source will create a Dataset that contains a TableAdapter. To support Generated Data Retrieval, a code modification must be performed to the Dataset designer code. The designer generates code to initialize the TableAdapter. This method InitAdapter () is generated which contains code to initialize the selected commands from the Data Source configuration wizard. The insert command (if selected) needs to define the GeneratedDataBehavior property to enable the DataTable rows to reflect generated data from the database insert or insert-select statement types. This code is a sample generated portion to illustrate the property addition.
C# |
Copy Code |
---|---|
private void InitAdapter() { this._adapter = new Teradata.Client.Provider.TdDataAdapter (); System.Data.Common.DataTableMapping tableMapping = new System.Data.Common.DataTableMapping (); tableMapping.SourceTable = "Table"; tableMapping.DataSetTable = "IdBak"; tableMapping.ColumnMappings.Add ("c1", "c1"); tableMapping.ColumnMappings.Add ("c2", "c2"); tableMapping.ColumnMappings.Add ("c3", "c3"); tableMapping.ColumnMappings.Add ("c4", "c4"); tableMapping.ColumnMappings.Add ("idcol", "idcol"); this._adapter.TableMappings.Add (tableMapping); this._adapter.InsertCommand = new Teradata.Client.Provider.TdCommand (); this._adapter.InsertCommand.Connection = this.Connection; this._adapter.InsertCommand.CommandText = "INSERT INTO \"cc2\".\"idall\" " + "(\"c1\", \"c2\", \"c3\", \"c4\", \"idcol\") " + "VALUES (?, ?, ?, ?, ?)"; this._adapter.InsertCommand.CommandType = System.Data.CommandType.Text; ... } |
Enabling generated data behavior in this DataAdapter requires an additional line of code setting the insert command GeneratedDataBehavior property to either AllColumns or IdentityColumn:
this._adapter.InsertCommand.GeneratedDataBehavior = Teradata.Client.Provider.GeneratedDataBehavior.AllColumns;
Example: Creating a data connection in Server Explorer
Use Large Decimal in Typed DataSet