I have put a DataGridView in my program such that this DataGridView is corresponding to a dataset of one table and this table has a auto-incremented identity column(also,this column is set to be primary key).
This identity column is not visible in DataGridView and when a user fills other cells and clicks "save",NoNullAllowedException occurs.
Why?I want to allow user to just insert data(not another modification)
How can I d开发者_如何学JAVAo?I use C# and SQL server 2008
Cheers
What's your target table definition? Does any column have the NOT NULL
restriction?
Look at your table and find all the columns that are NOT NULL and make sure the form is posting something into those fields.
If it really is just the Primary Key that's causing the issue verify that it works by posting data directly from SQL server management studio with T-SQL Code (INSERT INTO) etc.
精彩评论