I have a table with a Primary Key.
I am using Visual Basic as the fornt end, if a duplicate value goes into the primary key column an error occurs (obviously .....). I have put the insert into a transaction and if an @@error occurs it has a return value of 1 And the transaction rolls back. But this doesn't catch the error, I am given a violation error before it even gets to that stage!
So I am thinking, ok the @@error doesn't recognise an idiot putting a duplicate value in, so what does? How *are* you supposed to stop users typing in a duplicate values?
Hope you can help!
I am using Visual Basic as the fornt end, if a duplicate value goes into the primary key column an error occurs (obviously .....). I have put the insert into a transaction and if an @@error occurs it has a return value of 1 And the transaction rolls back. But this doesn't catch the error, I am given a violation error before it even gets to that stage!
So I am thinking, ok the @@error doesn't recognise an idiot putting a duplicate value in, so what does? How *are* you supposed to stop users typing in a duplicate values?
Hope you can help!