To use the .NET Data Provider for Teradata, you need to do the following:
imports
or using
statement for Teradata.Client.Provider namespace in your code.
Object | Description |
---|---|
TdConnection |
|
TdCommand |
|
TdDataReader |
|
TdDataAdapter |
|
The Hello World example below illustrates making a Connection to Vantage and executing "Select Date" using the TdDataReader.
C# |
Copy Code |
---|---|
using System; using System.Collections.Generic; using System.Text; using Teradata.Client.Provider; namespace Teradata.Client.Provider.HelloWorld { class HelloWorld { static void Main(string[] args) { using (TdConnection cn = new TdConnection("Data Source = x;User ID = y;Password = z;")) { cn.Open(); TdCommand cmd = cn.CreateCommand(); cmd.CommandText = "SELECT DATE"; using (TdDataReader reader = cmd.ExecuteReader()) { reader.Read(); DateTime date = reader.GetDate(0); Console.WriteLine("Teradata Database DATE is {0}", date); } } } } } |
Note |
---|
You can find more Coding Examples at <Installation-Directory>\Samples\LearningExamples directory. |