I need to sum all the values of a column containing in each row a specific date, that is, in the database, the values are saved with the date entered in textBox
in the act of the cadastre, and I must add all the values column quantidadeVagas
. So when the user types a date into the program, it returns the sum of that column with the data containing the date entered.
I did that, but it did not work:
string query = "Select sum (quantidadeVagas) from vagas where data like '%" + mTxtDataVagas.Text + "%'";
MySqlConnection conexao = new MySqlConnection();
conexao.ConnectionString = DadosDaConexao.StringDeConexao;
conexao.Open();
MySqlCommand cmdDataBase = new MySqlCommand(query, conexao);
MySqlDataReader myReader;
myReader = cmdDataBase.ExecuteReader();
while (myReader.Read())
{
int quantidade = Convert.ToInt32(myReader.GetString("count"));
}
The following error appears: