//este metodo trae los valores de una cuota en especifico recibiendo como parametro el valor internal Mercado GetCuota(int idMercado) { MySqlConnection con = Connect(); MySqlCommand command = con.CreateCommand(); string sql = "select * from mercado where ID =" + idMercado + ""; // sql = sql.Replace(",", "."); command.CommandText = sql; //command.CommandText = "select * from mercado where idmercado = 1.5 "; try { con.Open(); MySqlDataReader res = command.ExecuteReader(); Mercado m = null; while (res.Read()) { // Debug.WriteLine("Recuperado: " + res.GetFloat(0) + " " + res.GetFloat(1) + " " + res.GetFloat(2)); m = new Mercado(res.GetDecimal(0), res.GetFloat(1), res.GetFloat(2), res.GetFloat(3), res.GetFloat(4), res.GetInt16(5), res.GetInt32(6)); } con.Close(); return(m); } catch (MySqlException e) { Debug.WriteLine("Error de conexión"); return(null); } }
internal Mercado Retrieve() { MySqlConnection con = Connect(); MySqlCommand command = con.CreateCommand(); command.CommandText = "select * from mercado"; con.Open(); MySqlDataReader res = command.ExecuteReader(); Mercado m = null; while (res.Read()) { Debug.WriteLine("Recuperado: " + res.GetFloat(0) + " " + res.GetFloat(1) + " " + res.GetFloat(2) + " " + res.GetFloat(3) + " " + res.GetFloat(4) + " " + res.GetInt16(5)); m = new Mercado(res.GetDecimal(0), res.GetFloat(1), res.GetFloat(2), res.GetFloat(3), res.GetFloat(4), res.GetInt16(5), res.GetInt32(6)); } con.Close(); return(m); }