public static List <object[]> SelectQuery(string sql, string connection_string) { MySqlConnection conn = new MySqlConnection(connection_string); conn.Open(); MySqlCommand sql_comm = new MySqlCommand(sql, conn); MySqlDataReader MyDataReader; MyDataReader = sql_comm.ExecuteReader(); List <object[]> res = new List <object[]>(); while (MyDataReader.Read()) { object[] row = new object[MyDataReader.FieldCount]; MyDataReader.GetValues(row); res.Add(row); } return(res); }
private List <object[]> query(string sql) { MySqlConnection conn = new MySqlConnection(m_Cfg.DbConnectionString); conn.Open(); MySqlCommand sql_comm = new MySqlCommand(sql, conn); MySqlDataReader MyDataReader; MyDataReader = sql_comm.ExecuteReader(); List <object[]> res = new List <object[]>(); while (MyDataReader.Read()) { object[] row = new object[MyDataReader.FieldCount]; MyDataReader.GetValues(row); res.Add(row); } return(res); }