Recupero di più set di risultati

Microsoft.HostIntegration.MsDb2Client.MsDb2DataReader fornisce il Microsoft.HostIntegration.MsDb2Client.MsDb2DataReader.NextResult%2A metodo per scorrere più risultati restituiti.

Esempio

Nell'esempio seguente viene illustrato come recuperare più set di risultati.

Public void ReadMyData(string myConnString)  
{  
   string myCallQuery = "CALL MyReports()";  
   MsDb2Connection myConnection = new MsDb2Connection(myConnString);  
   MsDb2Command myCommand = new MsDb2Command(myCallQuery,myConnection);  
   myConnection.Open();  
   MsDb2DataReader myReader;  
   myReader = myCommand.ExecuteReader();  
   do  
      {  
      // Always call Read before accessing data.  
      While (myReader.Read())  
         {  
         Console.WriteLine(myReader.GetString(0) + " , ", "   
                 + myReader.GetString(1));  
         }  
       }  
   while(myReader.NextResult());  
   // Always call Close when done reading.  
   myReader.Close();  
   // Close the connection when done with it.  
   myConenction.Close();  
}  

Vedere anche

Uso del provider gestito per DB2
Guida per programmatori del provider gestito per DB2