Beispiel #1
0
 // <Snippet1>
 private static void PrintColumn(DataTableReader reader)
 {
     // Loop through all the rows in the DataTableReader
     while (reader.Read())
     {
         if (reader.IsDBNull(2))
         {
             Console.Write("<NULL>");
         }
         else
         {
             try
             {
                 Console.Write(reader.GetChar(2));
             }
             catch (InvalidCastException)
             {
                 Console.Write("Invalid data type.");
             }
         }
         Console.WriteLine();
     }
 }
 public char GetChar(int i)
 {
     return(_reader.GetChar(i));
 }