Listing 1:  GETDATA.C

using System;
using System.Data;
using MySql.Data.MySqlClient;

public class getdata
{
   public static void Main(String[] args)
   {
      MySqlConnection conn = new MySqlConnection("Server = localhost;
      Database = test; User Id = root; Password = testing");
      MySqlCommand comm = new MySqlCommand("Select * from employee", conn);
      conn.Open();
      MySqlDataReader data = comm.ExecuteReader();
      try
      {
         while(data.Read())
         {
            int empid = data.GetInt32(0);
            String lastname = data.GetString(1);
            String firstname = data.GetString(2);
            float salary = data.GetFloat(9);
            Console.WriteLine("{0} - {1},{2}   ${3}",
               empid, lastname, firstname, salary);
         }
      } catch (MySqlException e)
      {
         Console.WriteLine("Problem: {0}", e.Message);
      } finally
      {
         data.Close();
         conn.Close();
      }
   }
}