using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MySql.Data.MySqlClient;

namespace ConsoleApplication1
{
    class Program
    {
        public static int Main(string[] args)
        {
            Console.WriteLine("Hello World!");



            string connetionString = null;
            MySqlConnection cnn;
            connetionString = "server=192.168.40.20; database=d1; uid=test; pwd=password;";

            cnn = new MySqlConnection(connetionString);
            try
            {
                cnn.Open();
                Console.WriteLine("Succeed Open!");
                MySqlCommand command = new MySqlCommand("show global variables like 'server_id'", cnn);
                for (int i = 0; i < 10; i++)
                {
                    MySqlDataReader reader = command.ExecuteReader();
                    reader.Read();
                    Console.WriteLine(reader.GetValue(1));
                    reader.Close();
                }
                cnn.Close();
            }
            catch (Exception)
            {
                Console.WriteLine("Can not Open!");
            }

            Console.WriteLine("Please enter the key");
            Console.ReadKey();
            return 0;
        }
    }
}
