Neven Draskovic

Neven Draskovic

  • NA
  • 117
  • 138.1k

Controling duplicates in SQL database

May 15 2012 9:32 AM
Hey

I created an application that is used for controlling and recording contactless cards. When the card is pressed against the reader, my application records the cards serial number (if the serial number is read, the card is functioning properly) and stores it into a local SQL database. All this works fine, with one error that I can't solve. I marked the serial number column as Primary key so that if the same card is read, an exception would be thrown indicating that that specific card has already been recorded. The weird thing that keeps happening is that this exception is thrown exactly 6 times (every time), and then it stops appearing and the duplicate cards get recorded as normal ones. What is causing this, and is there some other way to control the input and warn the user about duplicates. I used VS 2010 and SQL Server 2005 to create my application

Thanks

Answers (3)