Skip to content

Instantly share code, notes, and snippets.

@kdeloach
Created January 13, 2016 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kdeloach/93c74970f52743eb8d39 to your computer and use it in GitHub Desktop.
Save kdeloach/93c74970f52743eb8d39 to your computer and use it in GitHub Desktop.
[Test]
public void TestBindingsRead()
{
string oradb = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=LR14)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=pdborcl.internal.azavea.com)));;User Id=unittest;Password=***;";
string queryString = "SELECT SDE.ST_SRID(SHAPE) || ':' || SDE.ST_AsText(SHAPE) AS SHAPE FROM unittest.DOR_PARCEL_READ WHERE (unittest.DOR_PARCEL_READ.STATUS IN (1, 2))";
using (OracleConnection connection = new OracleConnection(oradb))
{
OracleCommand command = new OracleCommand(queryString, connection);
connection.Open();
OracleDataReader reader;
reader = command.ExecuteReader();
// Always call Read before accessing data.
int i = 0;
while (reader.Read())
{
reader.GetString(0);
if (++i % 10000 == 0)
{
Console.Out.WriteLine(i.ToString());
}
}
// Always call Close when done reading.
reader.Close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment