Пример #1
0
        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;
        }
Пример #2
0
        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;
        }