title: How to count id and sort by date using charts C# programming
body: <p>What I'm trying to do is to create a chart that will count the total amount of patients then having it sort by date(by day) I have 
  Patient ID= id DA=as my day added Date of C= as my date added and DU= as my date updated I'm confused on how I will encode it, and what I'm trying to do is to create a chart that will be showing me the graph of patient count per day</p>
  
  <pre><code> try
          {
              OleDbCommand cmd = connection.CreateCommand();
              cmd.CommandText= "select count(PatientID) as id, 
    datename(DA,DateofC)as datename from Patient where 
   datediff(DA,DateofC,getdate()) = 0 group by DateofC";
              OleDbDataReader reader;
  
              reader= cmd.ExecuteReader();
              while(reader.Read())
              {
                  chartControl1.Series["PatientCount"].Points.AddPoint(reader["id"].ToString(),         
                 reader.GetInt32(0));
              }
  
          }
          catch
          {
              throw;
          }
          finally
          {
              if(connection.State == ConnectionState.Open)
                  connection.Close();
          }
  </code></pre>