Connecting to Teredata tables from VB Net

New Member

Connecting to Teredata tables from VB Net

I currently connect to sql srever tables inside of VB Net windows forms application using the SqlConnection and the SqlDataAdapter - like this:   

Dim strSQL As String = "Select Column_1 FROM [dbo].[Table1]

Dim cs As New SqlConnection("Data Source=slqServer_Server_Name;Initial Catalog=Database_Name;Integrated Security=True")

Dim da As New SqlDataAdapter(strSQL, cs)

Dim ds As New DataSet

Dim cmb As New SqlCommandBuilder(da)

I need to connect to TEREDATA tables in my VB Net forms applicaton - but I can't figure out what to do.

Could someone please help me to do something similar to this?



Teradata Employee

Re: Connecting to Teredata tables from VB Net

Download the .NET Data Provider for Teradata. Use the TdConnection, TdDataAdapter, TdCommandBuilder, TdCommand, TdDataReader ... classes instead of SqlConnection, SqlDataAdapter, SqlCommandBuilder and etc. 


You can download the .NET Data Provider for Teradata and the documentation from


Re: Connecting to Teredata tables from VB Net



You can use below code to connect to TD from .Net. There are help available on net also on this.

TdConnectionStringBuilder conStringBuilder;
TdConnection tdCon;
TdDataAdapter tdDA;
DataSet dsComp;
conStringBuilder = new TdConnectionStringBuilder();
conStringBuilder.DataSource = "???";
conStringBuilder.UserId = MyGlobals.myuserid;
conStringBuilder.Password = MyGlobals.mypassword;
conStringBuilder.ConnectionPooling = false;
o_queryband = my_query_band.Text.Trim();
using (tdCon = new TdConnection(conStringBuilder.ConnectionString))
		using (tdDA = new TdDataAdapter("exec mydb.User_Details;", tdCon))
			// create the dataset
			using (dsComp = new System.Data.DataSet())
				tdDA.Fill(dsComp, "T_Database");
				int iSchemaCnt = dsComp.Tables["T_Database"].Rows.Count;

				if (iSchemaCnt != 1)
					MessageBox.Show("Something strange");
					o_sessionid = dsComp.Tables["T_Database"].Rows[0]["session"].ToString().Trim();
					MessageBox.Show("Orig Session Fetched Successfully!!" + o_sessionid);

	catch (Exception ex)
		MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);

--Samir Singh