Beispiel #1
0
	public void BeginExecuteXmlReaderTest ()
	{
		cmd = new SqlCommand ();
		string connectionString1 = null;
		connectionString1 = ConnectionManager.Singleton.ConnectionString + "Asynchronous Processing=true";
		try {
			SqlConnection conn1 = new SqlConnection (connectionString1);
			conn1.Open ();
			cmd.CommandText = "Select lname from employee where id<2 FOR XML AUTO, XMLDATA";
			cmd.Connection = conn1;
		
			IAsyncResult result = cmd.BeginExecuteXmlReader ();
			XmlReader reader = cmd.EndExecuteXmlReader (result);
			while (reader.Read ()) {
				if (reader.LocalName.ToString () == "employee")
					Assert.AreEqual ("kumar", reader["lname"], "#1 ");
			}
		} finally {
			ConnectionManager.Singleton.CloseConnection ();
		}
	}