Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }