Click here to Skip to main content
11,706,455 members (36,445 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL PhoneGap
need to check duplicate item in my table before insert date .But i am getting error while checking.Here is my code.I need to check whether the element already exist then return false If not then return true.And create a new entry

function validationField() {
     db.transaction(getallTableCntend, errorCB);
   }
 
   function getallTableCntend(tx) {
       tx.executeSql('SELECT * FROM CaseTable', [], queryexcecute, errorCB);
   }
   function queryexcecute(tx, result) {
       var len = result.rows.length;
 
       for (var i = 0; i < len; i++) {
         if(result.rows.item(i).CaseName ==$('.caseName_h').val()){
           alert("Folder is already Exit.");
           isvalid=false;
           Break;
           return;;
         }
       }
      }

I am calling this like this.
$(document).on('click', '#AddButton', function() {
     isvalid = validationField();
    if (isvalid) {
            insertData();
            window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, onFileSystemSuccess, onFileSystemFail);
    }
});
Posted 12-Jul-13 8:47am
Edited 12-Jul-13 8:55am
(no name)103.9K
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 197
1 Sergey Alexandrovich Kryukov 141
2 chainerlt 110
3 Mika Wendelius 80
4 ppolymorphe 71
0 OriginalGriff 9,070
1 Sergey Alexandrovich Kryukov 8,413
2 CPallini 5,189
3 Maciej Los 4,746
4 Mika Wendelius 3,676


Advertise | Privacy | Mobile
Web03 | 2.8.150819.1 | Last Updated 12 Jul 2013
Copyright © CodeProject, 1999-2015
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