Brezhnews
Brezhnews

Reputation: 355

Saving data with autonumber primary key fields

enter image description here

This is my DB in PostgreSQL. All the id fields are serial. The problem is when I try to save data from datagridviews when I have entered values in all 3 tables, its not saving and shows error: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

The code with what I am saving:

        adptDelivery.Update((DataTable)DGV_Delivery.DataSource);
        adptProduct.Update((DataTable)DGV_Product.DataSource);
        adptProduct_Delivery.Update((DataTable)DGV_Product_Delivery.DataSource);

Upvotes: 0

Views: 319

Answers (1)

Scott Marlowe
Scott Marlowe

Reputation: 8910

I'm gonna guess that you're trying to insert a unique number that's already been inserted by another process. We need pseudo-code showing what you're doing and how you're doing it to really troubleshoot.

Upvotes: 1

Related Questions