Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public List<int> Temperatura()
- {
- List<int> Datos = null;
- string connStr = "server=localhost;user=root;database=sensores;port=3306;password=123456;";
- MySqlConnection conn = new MySqlConnection(connStr);
- try
- {
- Console.WriteLine("Connecting to MySQL...");
- conn.Open();
- string sql = "Select temperatura From datos where fecha between '" + Label3.Text + "' and '" + Label4.Text + "';";
- MySqlCommand cmd = new MySqlCommand(sql, conn);
- MySqlDataReader rdr = cmd.ExecuteReader();
- while (rdr.Read())
- {
- Datos.Add(Convert.ToInt32(rdr[0]));
- }
- rdr.Close();
- }
- catch (Exception ex)
- {
- Console.WriteLine(ex.ToString());
- }
- conn.Close();
- Console.WriteLine("Done.");
- return Datos;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement