I tried to connect to my Teradata server through C# (VS 2012 Express). But I kept getting error. I used MSSQL before. This is my first time using Teradata. I tried a few connectioin strings, but it did not help.
My OS is Windows 7 SP1 (64-bit). I have Teradata SQL Assistant (13.10.0.04) installed and connect to Teradata through ODBC.
my Teradata Client Provider version is v2.0.50727 (and referenced).
It seems I have problem in my connection string. Also, when to using TDConnection and when to use ODBCConnection?
Thank you in advance for your help.
An unhandled exception of type 'System.ArgumentException' occurred in Teradata.Client.Provider.dllAdditional information: Invalid connection string.
Here are the detailed error:
A first chance exception of type 'System.ArgumentException' occurred in Teradata.Client.Provider.dll
An unhandled exception of type 'System.ArgumentException' occurred in Teradata.Client.Provider.dll
Additional information: Invalid connection string.
'ClassRoom.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The program '[1460] 'ClassRoom.vshost.exe: Managed (v4.0.30319)' has exited with code 0 (0x0).
my Code block list below:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Teradata.Client.Provider;
namespace ClassRoom
{
TdConnection cn = new TdConnection();
try
{
cn = new TdConnection("Driver=Teradata; Server=myTeradataServerIPAddress; Database=myDefaultDB; Uid=myID; Pwd =myPwd;");
cn.Open();
string strSQL = "SELECT name FROM Class.English WHERE StudentID='0100'";
TdCommand cmd = new TdCommand(strSQL);
string results = (String)cmd.ExecuteScalar();
Console.WriteLine("Teradata Database is {0}", results);
cmd.Dispose();
}