/// <summary> /// Reset button event handler. /// Discard the existing mappings in the datagrid and /// build a new set from the database. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonReset_Click(object sender, System.EventArgs e) { if (this.dbAdapter == null) { System.Windows.Forms.MessageBox.Show( "Data Adapter is null; Table mappings is not available.", "Table Mappings"); return; } DataTableMappingCollection mapList = this.dbAdapter.TableMappings; if (mapList == null) { System.Windows.Forms.MessageBox.Show( "Data Adapter's Table mappings are null and are not available.", "Table Mappings"); return; } System.Data.DataTable dt; dt = TableMappings.BuildMapFromDatabase( DataAdapterUtil.GetDataAdapterClone(this.dbAdapter)); textBoxDatasetTable.Text = TableMappings.BuildDataSetNameFromCommand(this.dbAdapter); dt.AcceptChanges(); this.dataGrid1.DataSource = dt; } // buttonReset_Click