private void timer_in_program_Tick(object sender, EventArgs e) { conn.Open(); string query = "select timeprogram.id, polzovatel.id, timeprogram.yar, timeprogram.day, timeprogram.hour, timeprogram.minutes, timeprogram.second " + "from polzovatel inner join timeprogram on polzovatel.id_time_in_program = timeprogram.id " + "where polzovatel.id = '" + Function.ID() + "'"; MySqlCommand command = new MySqlCommand(query, conn); MySqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { yar = reader.GetInt32("yar"); day = reader.GetInt32("day"); hour = reader.GetInt32("hour"); minutes = reader.GetInt32("minutes"); second = reader.GetInt32("second"); } conn.Close(); Form2 f2 = new Form2(); second += 1; if (second == 60) { second = 0; minutes += 1; } if (minutes == 60) { minutes = 0; hour += 1; } if (hour == 24) { hour = 0; day += 1; } if (day == 365) { day = 0; yar += 1; } conn.Open(); string query_time = "update timeprogram set `yar` = '" + yar + "', `day` = '" + day + "', `hour` = '" + hour + "', " + "`minutes` = '" + minutes + "', `second` = '" + second + "' where timeprogram.id = '" + Function.ID() + "'"; MySqlCommand command1 = new MySqlCommand(query_time, conn); command1.ExecuteNonQuery(); conn.Close(); }
//Изменение информации о пользователе public static void Rename_field(MetroFramework.Controls.MetroTextBox m_textbox, string name_field) { string query = "update polzovatel set `" + name_field + "` = '" + m_textbox.Text + "' where `id` = '" + Function.ID() + "'"; MySqlConnection connection = new MySqlConnection(Server.connStr); connection.Open(); if (m_textbox.Text == "") { MessageBox.Show("Please fill in this field", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { MySqlCommand MSC = new MySqlCommand(query, connection); MSC.ExecuteReader(); } connection.Close(); }
public static void Update_table_passing(string name) { MySqlConnection connection = new MySqlConnection(Server.connStr); connection.Open(); string query_passing = "update passing SET " + name + " = 'yes' where id = '" + Function.ID() + "'"; MySqlCommand command = new MySqlCommand(query_passing, connection); command.ExecuteNonQuery(); connection.Close(); }