private void btnUpdate_Click(object sender, EventArgs e) { try { DataTable dataSource = (gridControl1.DataSource as DataTable); DataTable dtSelected = dataSource.Clone(); dtSelected.TableName = ListDatableName; int[] rows = gridView1.GetSelectedRows(); if (rows.Length == 0) { YYMessageBox.Show("选择要修改的行."); return; } if (rows.Length > 1) { YYMessageBox.Show("只能选择一行进行修改."); return; } dtSelected.Rows.Add(dataSource.Rows[rows[0]].ItemArray); doUpdate(dtSelected); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btnQuery_Click(object sender, EventArgs e) { try { query(); } catch (Exception ex) { YYMessageBox.Show(ex.Message); } }