Description: Scenario Using Visual Studio 2010 to create a screen with a datagridview.
The datasource of the datagridview is set to a My SQL table using the . The table has a primary key Problem When using previous versions of the connector all you had to do was set the primary key's default value to zero and the connector/Visual Studio took care of setting the actual key value as soon as the user added a new row to the datagridview. NET available messages but I'm not sure how to do this?
Changing the column in the dataset designer Allow DBNull = True does not make any difference.
End Edit() Line 70 0xe bytes C# Given this evidence it is probably a bug to manually set the autoid column with: private void data Grid View1_Default Values Needed(object sender, Data Grid View Row Event Args e) If you don't do it, you can later call Data Adapter. That is probably the best solution Another WA is to manually remove the primary key in the Form_Load after Fill call with: this.animals Table Adapter. I have tried not setting the value of the primary key column as suggested and just get an error saying that this column cannot be null.
Data Row Action e Action, bool fire Event = true) Line 3038 0x13a bytes C# System.
I have tried creating a brand new form and just adding a datagridview to it that is bound to my table (no "hand written code") and still get the same error:- System. No Null Allowed Exception: Column 'ID' does not allow nulls.
I'm obviously missing something as you appear to be able to get this to work and would be grateful if you could point me in the right direction as my "workaround" involves quite a bit of code that I'd like to do without.
It is before any attempt to update the database (in fact as stated above there is no code on the form to update the database).
Primary Key = null; Hi, Thank you for your feedback.
I wanna be able to update/delete data from a datagridview, and when I do that of course the data in my Postgre SQL database should be edited too.
Each row needs to be updated one row/feature at a time.