SHARE
TWEET

c#chart

lucacodorean Feb 27th, 2020 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.         /// <summary>
  3.         /// ar trebui sa iau numarul de imprumuturi facute in fiecare luna din fiecare an.
  4.         /// </summary>
  5.  
  6.         void usercountview(DateTime data)
  7.         {
  8.             OleDbConnection connection = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0; Data source = freebook.accdb;");
  9.             connection.Open();
  10.             OleDbCommand command = new OleDbCommand(
  11.                 @"SELECT
  12.                        Count(Year(data_imprumut)) as cate,
  13.                        month(data_imprumut) as luna,
  14.                        year(data_imprumut) as an
  15.            FROM imprumut
  16.            WHERE
  17.                    (((Year([data_imprumut])) <= year(@data_imprumut)
  18.                    And
  19.                    (Year([data_imprumut])) >= year(@data_imprumut)-1))
  20.            GROUP BY Year(data_imprumut), month(data_imprumut);", connection);
  21.             command.Parameters.AddWithValue("data_imprumut", data);
  22.             OleDbDataReader read = command.ExecuteReader();
  23.             while(read.Read())
  24.             {
  25.                 listBox1.Items.Add(read["cate"].ToString() + " " + read["luna"].ToString() + " " + read["an"].ToString());
  26.                 chartUsers.Series["Luna"].Points.AddXY(read["luna"].ToString(), read["cate"].ToString());
  27.             }
  28.             read.Close();
  29.             connection.Close();
  30.         }
  31.  
  32.         private void cbAni_SelectedIndexChanged(object sender, EventArgs e)
  33.         {
  34.            
  35.             DateTime data = new DateTime(int.Parse(cbAni.Items[cbAni.SelectedIndex].ToString()), 1, 1);
  36.             usercountview(data);
  37.         }
  38.  
  39.         /// cele mai mari 4 valori luate dupa imprumuturi.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top