Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Tools & Utilities

Reply
 
LinkBack Thread Tools Display Modes
Old 06-16-2011, 04:38 AM   #1 (permalink)
Registered Member
 
Join Date: Jun 2011
Posts: 7
Meet is on a distinguished road
Post How to prevent duplicate entry in database

Hello all

m working first time with database in iphone.

I want my applicatin to add a row on clicking a button.

all is goin wel, but my data is full of duplicate entries.

i dont know how to overcome it.

can nyone help????
Meet is offline   Reply With Quote
Old 06-16-2011, 05:02 AM   #2 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

before you use INSERT, you can do a SELECT with the data that you want to insert, if will return 0 record, then you will insert it, else no....


another approach is to use the right primary key (like name, surname) so that the db will reject record when you insert something with the same name,surname.
__________________

Last edited by dany_dev; 06-17-2011 at 07:29 AM.
dany_dev is offline   Reply With Quote
Old 06-17-2011, 04:15 AM   #3 (permalink)
Registered Member
 
Join Date: May 2011
Location: Warsaw
Posts: 21
ios dev is on a distinguished road
Default

Quote:
Originally Posted by Meet View Post
Hello all

m working first time with database in iphone.

I want my applicatin to add a row on clicking a button.

all is goin wel, but my data is full of duplicate entries.

i dont know how to overcome it.

can nyone help????
Can't you create UNIQUE key on the column?
You will get errors when trying to insert duplicate values.
__________________
------------------
JellyBugs game iPhone
------------------
Android outsourcing |iPhone outsourcing |
ios dev is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 412
11 members and 401 guests
AppleDev, chemistry, Emy, Gi-lo, ipodphone, mistergreen2011, pipposanta, QuantumDoja, Retouchable, SLIC
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,679
Threads: 94,129
Posts: 402,924
Top Poster: BrianSlick (7,990)
Welcome to our newest member, xzoonxoom
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 08:27 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0