Win a copy of Java Persistence with Spring Data and Hibernate this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris

Checking for duplicates android sql using multiple columns

Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an app that scans a bar code and enters the info in to a db in my app. What I need it to do is check the db for the information when the bar code is scanned, and then either write the info to the db or show a toast letting the user know that the bar code has already been scanned for this event, on this date, for this user and can not be entered in the db again. There are three columns that I need it to query against, date, event, and empID. I have gotten to where it will alert when a duplicate is found, but it is still writing to the db and the toast is staying on the screen a lot longer than it should. I have tried to add break; in the if statement after the toast and after where it is writing to the db, but it caused it to write to the db multiple times for some reason. This is my first attempt with android db and I am still new to SQLite as well, so any help someone can offer is greatly appreciated.

Here is the public cursor from my db helper class if needed.
Always! Wait. Never. Shut up. Look at this tiny ad.
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
    Bookmark Topic Watch Topic
  • New Topic