public BoxMenu() { InitializeComponent(); sql = new Sql(); //.btnCreateTB(); dataGridView1.DataSource = sql.query("update Box_Data SET 包廂狀態 = '2' where unix_timestamp(離場時間) < unix_timestamp(sysdate()); select *, DATE_FORMAT(入場時間,'%Y-%m-%d %T') as 入場2 from Box_Data"); addTime(); }
private void 查詢包廂狀態_Load(object sender, EventArgs e) { DataTable table = sql.query(String.Format(@" update Box_Data SET 包廂狀態 = '2' where unix_timestamp(離場時間) < unix_timestamp(sysdate()); select * from Box_Data where 包廂編號 = '{0}'; ", boxNum)); dataGridView1.DataSource = table; label5.Text = table.Rows[0][0].ToString(); label6.Text = table.Rows[0][1].ToString(); label7.Text = table.Rows[0][4].ToString(); label8.Text = table.Rows[0][6].ToString() + "小時"; label10.Text = table.Rows[0][5].ToString(); }
private DataTable checkBoxStatus() // 查詢包廂狀態 { DataTable box = sql.query("update Box_Data SET 包廂狀態 = '2' where unix_timestamp(離場時間) < unix_timestamp(sysdate()); select *, DATE_FORMAT(入場時間,'%Y-%m-%d %T') as 入場2 from Box_Data where 包廂編號 = '" + textBox5.Text + "' and 包廂狀態 = '1'"); return(box); }