Can a DatagridView suspend primary key contraints while editing?
Posted on 2014-03-17
I have a Datagridview with data binding to a datatable from a dataset.
The bound table has the following columns:
RecYear primaryKey - also foreign key in linked table
RecID primaryKey - also foreign key in linked table
I want to only show two columns in the grid: SampleType and SampleCount
Inserting new data into the table is taken care of by a stored procedure which takes five parameters: @SampleType and @SampleCount.
Pluss: @RecYear', '@RecID' and '@SampleID output'.
@RecYear', '@RecID' I will set in my Save method of the form.
The sampleID is calculated in the stored procedure. So: Output parameter only
The problem is that the datagrid and the bound datatable cannot wait with the assigning of the primary keys until I want to 'batch save' added records. The grid throws error/warning after leaving the the first new row in the grid.
Is is possible for make the bound datatable ignore lacking null-data for primary keys until updating the table on the SQL server?
I use dataset, tableadapter and bindingsource