示例#1
0
        private dataCount SendQuery(string query, string column)
        {
            dataCount data = new dataCount("", 0);

            if (this.OpenConnection())
            {
                // Create command and assign the query and connection from the constructor
                MySqlCommand cmd = new MySqlCommand(query, connection);

                //Create a reader to get the data from the database
                MySqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    data.changeData(reader.GetString(column));
                    data.incrementCount();
                }

                this.CloseConnection();
            }

            return(data);
        }
示例#2
0
        private dataCount SendQuery(string query, string column)
        {
            dataCount data = new dataCount("", 0);
            if (this.OpenConnection())
            {
                // Create command and assign the query and connection from the constructor
                MySqlCommand cmd = new MySqlCommand(query, connection);

                //Create a reader to get the data from the database
                MySqlDataReader reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    data.changeData(reader.GetString(column));
                    data.incrementCount();
                }

                this.CloseConnection();
            }

            return data;
        }