Count values in a Msaccess table

Asked

Viewed 74 times

0

I am creating my first application and would like to know how count values of a table in Msaccess with the following conditions:

  • "requester" and "Status" must contain specific values;
  • If it contains the data solicitante = solicitante1 and status = aberto, count all values meeting this condition.

I tried something like this but I can’t return values. I tried using COUNT also.

If anyone can give me a light on how to do the condition test and store the values in a variable. Thanks in advance.

string query7 =  " SELECT (Status_Solicitante)  from Cartoes where Status_Solicitante='"+"Aberto" + Solic+"'";
command7.CommandText = query7;
OleDbDataReader reader7 = command7.ExecuteReader();
while (reader7 .Read())
{
    label11.Text =  reader7.ToString();
}
  • Where do you select the Status?

  • as I did not know how to evaluate the two fields I put a field where the two fields are joined Status_requester where in this field when the user save it will be filled with the word Abertosolicitante. what I need is to count this field.

  • in the field of the table called Status = Open, Requester = Requester.

  • You just want to count how many records on the table meet your condition, right?

  • exactly, I need to know how many records were opened by a particular requester and with open status.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.