'Declaration Public Function EndExecuteXmlReader( _ ByVal ar As IAsyncResult _ ) As XmlReader
public XmlReader EndExecuteXmlReader( IAsyncResult ar )
Parameters
- ar
Return Value
A System.Xml.XmlReader object.
'Declaration Public Function EndExecuteXmlReader( _ ByVal ar As IAsyncResult _ ) As XmlReader
public XmlReader EndExecuteXmlReader( IAsyncResult ar )
Refer to "Asynchronous Query Execution" article for detailed information.
Public void Async_Exec(SqlConnection myConnection) { SqlCommand myCommand = new SqlCommand("SELECT * FROM Test.Dept",myConnection); Console.WriteLine("Starting asynchronous retrieval of data..."); myConnection.Open(); IAsyncResult cres = myCommand.BeginExecuteReader(null,null,CommandBehavior.Default); if (cres.IsCompleted) Console.WriteLine("Completed."); else Console.WriteLine("Have to wait for operation to complete..."); SqlDataReader myReader = myCommand.EndExecuteReader(cres); try { while (myReader.Read()) { Console.WriteLine(myReader.GetInt32(0) + " " + myReader.GetString(1) + " " + myReader.GetString(2)); } } finally { myReader.Close(); myConnection.Close(); } }
Public Sub Async_Exec(ByVal myConnection As SqlConnection) Dim myCommand As New SqlCommand("SELECT * FROM Test.Dept", myConnection) Console.WriteLine("Starting asynchronous retrieval of data...") myConnection.Open() Dim cres As IAsyncResult = myCommand.BeginExecuteReader(Nothing, Nothing, CommandBehavior.Default) If cres.IsCompleted Then Console.WriteLine("Completed.") Else Console.WriteLine("Have to wait for operation to complete...") End If Dim myReader As SqlDataReader = myCommand.EndExecuteReader(cres) Try While myReader.Read() Console.WriteLine(String.Concat(myReader.GetInt32(0), " ", myReader.GetString(1), " ", myReader.GetString(2))) End While Finally myReader.Close() myConnection.Close() End Try End Sub
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
SqlCommand Class
SqlCommand Members
BeginExecuteXmlReader Method
Devart.Data.SqlServer.SqlCommand..ExecuteXmlReader
EndExecuteNonQuery Method