Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi..
I uploaded data from excel to store in db. if der is no repeated values means its getting uploaded. but if i hav same data in both DB and in Excel its rejecting whole excel sheet bcoz of my primary key in database. i want to upload all datas other tan primary key field.

Example:
Datas in Database(here i set primary key for numb)

numb name sex

1 shalu fem
2 sugan fem
3 prabha male

datas in Excel

100 suba fem
101 arun male
2 sugan fem( this row should not upload)
Posted
Updated 30-Jan-13 19:26pm
v2
Comments
Jameel VM 31-Jan-13 0:15am    
Please improve your question by adding what you have tried

Better you try to check the condition before insert the data into DB if the PK value is already exists in DB then no need to insert otherwise it's inserted..

(or)

In DB itself you set the PK column as Auto increment column.
 
Share this answer
 
v2
Comments
shaluanbu 31-Jan-13 1:40am    
User cant able to see DB rit.. den how dey know whether its primary key or not.. i need to upload all dats other tan primary key values. but its rejecting whole excel sheet.
Naveen.Sanagasetti 31-Jan-13 1:45am    
I told you in coding wise you do that stuff, your not an end user ... right..?, you know that logic , what are the PK column etc.. so, you do that stuff in your coding wise i'm also do the excel uploading concept, my table PK col is auto increment column . So, i never face this type of issue. But in some other page i'm facing this issue at that time i'm checking whatever i mentioned in my solution
shaluanbu 31-Jan-13 1:56am    
Yah sure i ll do tat.. tanq..
Hi
kindly describe your data structure, which field is your primary key.
 
Share this answer
 
Comments
Naveen.Sanagasetti 31-Jan-13 1:49am    
In question it self they mentioned that, PK col is "numb".

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