我程序里的datagridview是用bindingsource进行数据绑定,然后运行的时候,我有个操作就是通过按钮点击,在datagridview中添加一个新行,现在的问题是,新增的新行的主键列的值是已经存在的,谁知道是怎么回事么?下面是通过按钮点击新增行的代码private void toolAdd_Click(object sender, EventArgs e)
        {
            CurrencyData.tcCurrencyRow codeRow;            codeRow = (CurrencyData.tcCurrencyRow)(((DataRowView)this.bindSource.AddNew()).Row);
            foreach (DataGridViewRow gridRow in this.dataView.Rows)
            {
                if (gridRow.Cells[this.colCode.Index].Value.ToString() == codeRow.Code)
                {
                    this.dataView.CurrentCell = gridRow.Cells[this.ColCNDesc.Index];
                    this.dataView.BeginEdit(false);
                    break;
                }
            }
        }