Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone,

Can any one tell me how to validate the Duplicate record before Inserting and Updating Command is Trigered from VB.Net Form. I am new to VB.


Tashee
Posted

Similar question with answers

Handling duplicates[^]
 
Share this answer
 
Actually the best way to handle this, is a unique constraint on the data table.
If this is not an option you have to do a select on the on the table to check for results.
If there are now rows returned you may insert.

Using MySQL DB there's another solution. You can do

SQL
INSERT INTO table (a,b,c) VALUES (1,2,3)
  ON DUPLICATE KEY UPDATE c=c+1;


Don't know if this syntax also aplies to other DBEs.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900