ExecuteXmlReaderAsync
Overload List:
The method ExecuteXmlReaderAsync returns a Task-based asynchronous version of OracleCommand.ExecuteXmlReader(), which fetches the result set as an XmlReader object.
-
This method returns a Task-based asynchronous version of
OracleCommand.ExecuteXmlReader(), which fetches the result set as anXmlReaderobject. -
ExecuteXmlReaderAsync(CancellationToken)
This method returns a Task-based asynchronous version of
OracleCommand.ExecuteXmlReader(), which fetches the result set as anXmlReaderobject.
Example (includes overloads)
using Oracle.ManagedDataAccess.Client;
using System;
using System.Threading;
using System.Xml;
namespace AsyncApp
{
class AsyncDemo
{
static async Task Main()
{
string connectionString = "User Id=HR; Password=<PASSWORD>; Data Source=oracle;";
OracleConnection oc = new OracleConnection(connectionString);
await oc.OpenAsync(CancellationToken.None);
OracleCommand cmd = oc.CreateCommand();
cmd.CommandText = "select * from demo_table";
XmlReader reader;
reader = await cmd.ExecuteXmlReaderAsync();
while (reader.Read())
{
Console.WriteLine(reader.Value);
}
reader = await cmd.ExecuteXmlReaderAsync(CancellationToken.None);
while (reader.Read())
{
Console.WriteLine(reader.Value);
}
}
}
}