Quantcast
Viewing all articles
Browse latest Browse all 12583

Autoseedincrement on column throwing primary key exception due to not incrementing

Hi there.

I am currently working on a project for my databases paper, the goal is to create a windows forms project which will interface with my database. 

I am having an issue which i have spent 2 hours trying to get working but can't get it sorted. I have multiple datasets referencing a message table which facilitates message sending between users. 

I have the primary key set to autoincrement in the properties of the column with a seed of 1 and an increment of 1. Now i have one form which is a messaging form that will add a new message to the database and it will increment from the last stored value however i have another form that generates a message to a user when you click a button but this doesn't increment and it just tries to create a new message from the seed of 1 which of course already exists so it throws a primary key exception.

Please let me know how i can solve this problem or if i need to add any more information.


Thanks


Viewing all articles
Browse latest Browse all 12583

Trending Articles