private void ToolStripMenuItemChangeCarNo_Click(object sender, EventArgs e) { string ItemName = ((ToolStripMenuItem)sender).Name; string State = ItemName.Substring(ItemName.Length - 1, 1); if (this.dgvMain.CurrentCell != null) { BLL.BLLBase bll = new BLL.BLLBase(); string TaskNo = this.dgvMain.Rows[this.dgvMain.CurrentCell.RowIndex].Cells[0].Value.ToString(); string CraneNo = this.dgvMain.Rows[this.dgvMain.CurrentCell.RowIndex].Cells["colCraneNo"].Value.ToString(); frmTaskCarNo f = new frmTaskCarNo(CraneNo); if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string CarNo = f.carNo; bll.ExecNonQuery("WCS.UpdateTaskCarNoByTaskNo", new DataParameter[] { new DataParameter("@CarNo", CarNo), new DataParameter("@TaskNo", TaskNo) }); } BindData(); } }