Click here to Skip to main content
15,867,330 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am doing E commerce project.i am inserted PID,Product Name in Product Table.But same Product Name inserted Multiple times in Product Table.How avoid this one please help me.
Posted
Comments
Charan_Kumar 4-Mar-14 2:40am    
ontextchanged property for textbox check the string is exists or not by writing query...

1. I dont know about your database design. But it would better if you added a product code.
2. You can check existing product name before insert in your query/procedure.
2.1. You can check in IF condition with To Upper/ to Lower the both side.
2.2. You can check in IF condition with remove the space and to upper/to lower the both side( I am not talking to remove space for insert, I mean you can use replace method in if condition for checking purpose).
3. In product table you can set unique key type the product name.

For query help you can follow this one

http://stackoverflow.com/questions/17442901/how-to-avoid-duplicate-values-for-insert-in-sql[^]

Thanks.
 
Share this answer
 
See my past answer here : How to reduce the duplication insert the table values.[^] - Solution #2

-KR
 
Share this answer
 
place if exist condition in stored procedure
check whether the product is existed or not
 
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