예제 #1
0
        public static void Connect()
        {
            string          connectStr = "server=168.33.162.63;port=3306;user=root;password=fairhr0755SZ; database=HealthCheck;";
            string          sql        = "select * from orders where id = '1997'";
            MySqlConnection conn       = new MySqlConnection(connectStr);

            try
            {
                conn.Open();
                MySqlCommand    cmd    = new MySqlCommand(sql, conn);
                MySqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    string name = reader.GetString("PeopleName");
                    string s    = reader.GetEnumerator().ToString();
                    Console.WriteLine(name + s);
                }
            }
            catch (MySqlException ex)
            {
                Console.WriteLine(ex);
            }
            finally
            {
                conn.Close();
            }
        }
예제 #2
0
        public static EmpModel GetEmployee(int?id)
        {
            EmpModel model = new EmpModel();

            using (MySqlConnection con = new MySqlConnection(conString))
            {
                con.Open();
                using (MySqlCommand cmd = new MySqlCommand())
                {
                    cmd.Connection  = con;
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = "Select * from employee where EmpId = " + id + "";
                    MySqlDataReader rdr = cmd.ExecuteReader();
                    model = (EmpModel)rdr.GetEnumerator().Current;
                }
                con.Close();
            }
            return(model);
        }
예제 #3
0
 public override IEnumerator GetEnumerator()
 {
     return(reader.GetEnumerator());
 }
 public IEnumerator GetEnumerator()
 {
     return(_mySqlDataReader.GetEnumerator());
 }
예제 #5
0
 public IEnumerator GetEnumerator() => _dataReader.GetEnumerator();