• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Checking for duplicates android sql using multiple columns

 
Greenhorn
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic