private void PopulateColumns( ) { _tblCols.Clear(); TableWrapper hostTable = cmbRefTables.SelectedItem as TableWrapper; NameIdPair pkConstraint = cmbRefPk.SelectedItem as NameIdPair; ForeignKeyWrapper fk = cmbFk.SelectedItem as ForeignKeyWrapper; if (hostTable == null || pkConstraint == null || fk == null) { return; } DataTable tbl = DbCmd.GetColumnsByForeignKey(_cp, hostTable.ID, pkConstraint.Id); DataRow newRow = null; foreach (DataRow row in tbl.Rows) { newRow = _tblCols.NewRow(); newRow["refCol"] = row["colName"]; newRow["hostCol"] = fk.GetColumns((string)row["colName"]); _tblCols.Rows.Add(newRow); } bsCols.DataSource = _tblCols; }
private void HandleReferencePrimaryKeyChanged( ) { _tblCols.Clear(); TableWrapper hostTable = cmbRefTables.SelectedItem as TableWrapper; NameIdPair pkConstraint = cmbRefPk.SelectedItem as NameIdPair; if (hostTable == null || pkConstraint == null) { return; } DataTable tbl = DbCmd.GetColumnsByForeignKey(_cp, hostTable.ID, pkConstraint.Id); DataRow newRow = null; foreach (DataRow row in tbl.Rows) { newRow = _tblCols.NewRow(); newRow["refCol"] = row["colName"]; _tblCols.Rows.Add(newRow); } bsCols.DataSource = _tblCols; }