Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Windows.Forms.DataVisualization.Charting;
- using MySql.Data.MySqlClient;
- namespace WindowsFormsApp3
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- this.chart1.Series.Add("Blocks");
- this.chart1.Series[0].ChartType = SeriesChartType.Column;
- chart1.ChartAreas[0].AxisX.LabelStyle.Angle = 45;
- chart1.ChartAreas[0].AxisX.Interval = 0.5;
- string MySQLconnectionstring = "datasource=127.0.0.1;port=3306;username=root;password=;database=project";
- MySqlConnection connection = new MySqlConnection(MySQLconnectionstring);
- string qwerty = "SELECT * FROM `misdrijven_drenthe` WHERE 1";
- MySqlConnection databaseconnection = new MySqlConnection(MySQLconnectionstring);
- MySqlCommand dbquery = new MySqlCommand(qwerty, databaseconnection);
- dbquery.CommandTimeout = 60;
- MySqlDataReader reader;
- try
- {
- databaseconnection.Open();
- reader = dbquery.ExecuteReader();
- if (reader.HasRows)
- {
- while (reader.Read())
- {
- string[] row = {reader.GetString(0), reader.GetString(1)};
- comboBox1.Items.Add(reader.GetString(0));
- }
- }
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e)
- {
- Console.WriteLine("CSGO");
- }
- public void UpdateChart()
- {
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (comboBox1.Text != "")
- {
- string MySQLconnectionstring =
- "datasource=127.0.0.1;port=3306;username=root;password=;database=project";
- MySqlConnection connection = new MySqlConnection(MySQLconnectionstring);
- string qwerty = "SELECT * FROM `misdrijven_drenthe` WHERE 1";
- MySqlConnection databaseconnection = new MySqlConnection(MySQLconnectionstring);
- MySqlCommand dbquery = new MySqlCommand(qwerty, databaseconnection);
- dbquery.CommandTimeout = 60;
- MySqlDataReader reader;
- try
- {
- databaseconnection.Open();
- reader = dbquery.ExecuteReader();
- if (reader.HasRows)
- {
- while (reader.Read())
- {
- Globals.Gemeente = reader.GetString(0);
- }
- }
- databaseconnection.Close();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement