All Forums Third Party Software
akhshay 16 posts Joined 07/08
21 Aug 2008
.NET unable to fetch the data from teradata

hiI am using .NET as a frontend and trying to connect to teradata edw of our company for accessing data.i am using odbc. following is the code: protected void Button1_Click(object sender, EventArgs e) { Microsoft.Data.Odbc.OdbcConnection oODBCConnection; OdbcCommand cmd; OdbcDataReader rdr; string sConnString = "Dsn=TDEDW1;Driver={Teradata};uid=appl_student_t_04; Database = t_student04_1;Pwd = Training_04"; oODBCConnection = new OdbcConnection(sConnString); oODBCConnection.Open(); string strSQL = "Select ShipToCustomer From T_STUDENT04_1.orderdetails where OrderID=10926 and UnitPrice=6.00"; cmd = new OdbcCommand(strSQL, oODBCConnection); rdr = cmd.ExecuteReader(); TextBox1.Text = rdr.GetName(0); TextBox2.Text = rdr.GetString(0); rdr.Close(); cmd.Dispose(); oODBCConnection.Close();the problem is it shows the column name, but says no data exist for a particular row/column.the same query gives data when used in Teradata SQL assistant.textbox1 gives the field shiptocustomer but for textbox2 vs says no data exist.thank you :-)regardsAkhshay Gandhi.

akhshay 16 posts Joined 07/08
22 Aug 2008

hi everyonei found the error... its because i was not using after rdr = cmd.executereader();thank you :-)

You must sign in to leave a comment.