private void dataGridView1_CurrentCellChanged(object sender, EventArgs e) { try { // textBox.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString(); textBox1.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString(); if (textBox1.Text != "") {//경로 변경 필수 pictureBox2.Load(ImgPath.imgPath() + textBox1.Text); } } catch (Exception) { } }
public FormHome() { InitializeComponent(); this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; if (sql.Query_Select_Bool("TBL_IMG", " imgName is Not null")) { String img = sql.Query_Select_DataSet("imgName", "TBL_IMG", " ").Tables[0].Rows[0]["imgName"].ToString(); //경로 자기 파일 위치에 따라 다르니 그때 그때 변경 바람 pictureBox1.Load(ImgPath.imgPath() + img); } if (sql.Query_Select_Bool("TBL_MEMBER", " seatNo is not null")) { //사용중인 좌석 개수를 구한다. DataSet ds = sql.Query_Select_DataSet("seatNo,expiredTime", " Where seatNo is not null", "TBL_MEMBER"); count = int.Parse(ds.Tables[0].Rows.Count.ToString()); seatNo = new String[count]; timEnd = new DateTime[count]; for (int i = 0; i < count; i++) { seatNo[i] = ds.Tables[0].Rows[i]["seatNo"].ToString(); timEnd[i] = Convert.ToDateTime(ds.Tables[0].Rows[i]["expiredTime"].ToString()); DateTime timeNow = DateTime.Now; if (timEnd[i] < timeNow) { if (sql.Query_Select_Bool("TBL_MEMBER", " seatNo = " + seatNo[i] + " and memberbool = 'true'")) { sql.Query_Modify("UPDATE TBL_MEMBER SET seatNo = NULL , expiredTime = NULL WHERE seatNo = " + seatNo[i]); } else { sql.Query_Modify("DELETE FROM TBL_MEMBER WHERE seatNo = " + seatNo[i] + " and memberbool = 'false'"); } sql.Query_Modify("UPDATE TBL_SEAT SET status = 'FALSE' WHERE seatNo=" + seatNo[i]); } } } seats(); }