Advertisement
Guest User

print

a guest
Mar 27th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.85 KB | None | 0 0
  1. public form 1
  2. chart1.ChartAreas[0].AxisX.Interval = 0.5;
  3.  
  4.  
  5.  
  6. private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  7. {
  8.  
  9. string constring = "datasource=localhost;port=3306;username=root;password=admin";
  10. string Query = "select * from project.gemeentemisdrijven where Gemeenten = '" + comboBox1.Text + "' LIMIT 0, 1";
  11. MySqlConnection conDataBase = new MySqlConnection(constring);
  12. MySqlCommand cmdDataBase = new MySqlCommand(Query, conDataBase);
  13. MySqlDataReader myReader;
  14.  
  15. try
  16. {
  17. conDataBase.Open();
  18. myReader = cmdDataBase.ExecuteReader();
  19. if (myReader.HasRows)
  20. {
  21. List<int> yValues = new List<int>();
  22. int count = myReader.FieldCount;
  23. while (myReader.Read())
  24. {
  25.  
  26. for (int i = 1; i <19; i++)
  27. {
  28. yValues.Add(Int32.Parse(myReader.GetString(i)));
  29. Console.WriteLine(myReader.GetValue(i));
  30. }
  31.  
  32.  
  33. }
  34.  
  35. string[] xValues = {"Bedreigingen","Brand/ontploffingen", "Diefstal van motorvoertuigen", "Diefstal uit/vanaf motorvoertuigen", "Diefstal/inbraak bedrijven/instellingen", "Diefstal/inbraak garage/schuur/tuinhuis", "Drugshandel", "HIC: Diefstal/inbraak woning, voltooid", "HIC: Diefstal/inbraak woning, pogingen", "HIC: Geweldsmisdrijven", "HIC: Straatroof", "HIC: Overvallen", "Huisvredebreuk","Huisvredebreuk",
  36. "Mishandeling","Openlijk geweld (persoon)","Vernieling cq. zaakbeschadiging","Wapenhandel" };
  37. chart1.Series[0].Points.DataBindXY(xValues, yValues);
  38. }
  39.  
  40. }
  41. catch (Exception ex)
  42. {
  43. MessageBox.Show(ex.Message);
  44. }
  45.  
  46.  
  47.  
  48.  
  49. }
  50.  
  51. private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
  52. {
  53.  
  54. string constring = "datasource=localhost;port=3306;username=root;password=admin";
  55. string Query = "select * from project.gemeentemisdrijven where Gemeenten = '" + comboBox2.Text + "' LIMIT 0, 1";
  56. MySqlConnection conDataBase = new MySqlConnection(constring);
  57. MySqlCommand cmdDataBase = new MySqlCommand(Query, conDataBase);
  58. MySqlDataReader myReader;
  59.  
  60. try
  61. {
  62. conDataBase.Open();
  63. myReader = cmdDataBase.ExecuteReader();
  64. if (myReader.HasRows)
  65. {
  66. List<int> yValues = new List<int>();
  67. int count = myReader.FieldCount;
  68. while (myReader.Read())
  69. {
  70.  
  71. for (int i = 1; i < 19; i++)
  72. {
  73. yValues.Add(Int32.Parse(myReader.GetString(i)));
  74. Console.WriteLine(myReader.GetValue(i));
  75. }
  76.  
  77.  
  78. }
  79.  
  80. string[] xValues = {"Bedreigingen","Brand/ontploffingen", "Diefstal van motorvoertuigen", "Diefstal uit/vanaf motorvoertuigen", "Diefstal/inbraak bedrijven/instellingen", "Diefstal/inbraak garage/schuur/tuinhuis", "Drugshandel", "HIC: Diefstal/inbraak woning, voltooid", "HIC: Diefstal/inbraak woning, pogingen", "HIC: Geweldsmisdrijven", "HIC: Straatroof", "HIC: Overvallen", "Huisvredebreuk","Huisvredebreuk",
  81. "Mishandeling","Openlijk geweld (persoon)","Vernieling cq. zaakbeschadiging","Wapenhandel" };
  82. chart1.Series[1].Points.DataBindXY(xValues, yValues);
  83. }
  84.  
  85. }
  86. catch (Exception ex)
  87. {
  88. MessageBox.Show(ex.Message);
  89. }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement