VB.Net 'Caught Exception' error re-occuring

A

anthony

New to vb.net! What's the best way to handle this scenario:
I have a vb.net app (SQL Server DB). When 2 or more users are running
the app simultaneously, I recently keep getting: 'Caught Exception':
The statement has been terminated'. Violation of Primary Key
Constraint. Cannot insert duplicate key in...

What's the best way to code that Try/Catch Block. Thanks,
..net newbie
 
M

Max

The issue is not so much with your try catch block, although you could use
it to fix the problem, if it is happening whenever more then one user is on
you have a problem with the database design as you are not incrementing your
primary key.
 
A

anthony

The P-Key is incrementing, but the form is so long that sometimes user
#2 will attempt to add a new record and get the same P-Key as user #1
because user #1 is not finished adding information yet. Any ideas?
Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top