![]() |
|
Archives of the TeradataForumMessage Posted: Thu, 25 Mar 2004 @ 17:39:27 GMT
<-- Anonymously Posted: Thursday, March 25, 2004 12:18 --> Has anyone managed to write a C# application that can get at the rows returned count before returning the full result set? I can attach to teradata using ODBC, but obviously I want to interrupt a query that's going to return millions of rows. Can anyone help? Here's a snippet of code that might be useful. using Microsoft.Data.Odbc;
public class QueryManager
{
private OdbcConnection odbcConnection1 = new OdbcConnection();
private OdbcCommand odbcCommand1 = new OdbcCommand();
public QueryManager()
{
this.odbcCommand1.Connection = this.odbcConnection1;
}
public void RunQuery(string DSN, string queryText)
{
this.odbcConnection1.ConnectionString = DSN;
this.odbcCommand1.CommandTimeout = 9000;
this.odbcCommand1.CommandText = queryText;
try
{
this.odbcConnection1.Open();
OdbcDataReader reader = this.odbcCommand1.ExecuteReader();
/* do something useful */
reader.Close();
}
catch (OdbcException odbcex)
{
System.Console.WriteLine(odbcex.Message);
}
finally
{
this.odbcConnection1.Close();
}
}
}
| ||||||||||||||||||||||||||||||||||||||||||||||||
| | ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||