Click here to Skip to main content
13,350,861 members (52,479 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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.

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 30-Jan-13 19:08pm
Updated 30-Jan-13 20:26pm
JemiM 31-Jan-13 0:15am
Please improve your question by adding what you have tried
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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..


In DB itself you set the PK column as Auto increment column.
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.
naveensenagasetti 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..
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

kindly describe your data structure, which field is your primary key.
naveensenagasetti 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.180111.1 | Last Updated 31 Jan 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100