title: IOS - SQLite DELETE data fail
body: <p>I have a little problem with my database,last time It's work.</p>
  
  <p>but now I can not delete my data from database.</p>
  
  <p>Here's code</p>
  
  <pre><code>   NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      NSString *documentsDirectory = [paths objectAtIndex:0];
      NSString *path = [documentsDirectory stringByAppendingPathComponent:@"ShopBook.db"];
      if (sqlite3_open([path UTF8String], &amp;db) == SQLITE_OK) {
          const char *sql = "SELECT * FROM ShopBook";
          sqlite3_stmt *searchStatement;
          if (sqlite3_prepare_v2(db, sql, -1, &amp;searchStatement, NULL) == SQLITE_OK) {
  
              while (sqlite3_step(searchStatement) == SQLITE_ROW) {
  
                  NSString *tempQRcodeList = [NSString stringWithUTF8String:(char *)sqlite3_column_text(searchStatement, 5)];
  
  //                {...do something...}             
                  sqlite3_finalize(searchStatement);
                  NSString *deleteSQL = [NSString stringWithFormat: @"DELETE FROM ShopBook WHERE qrCode = \"%@\"", tempQRcodeList];//I already have this data in database.
  
                  const char *delete_stmt = [deleteSQL UTF8String];
                  sqlite3_prepare_v2(db, delete_stmt, -1, &amp;searchStatement, NULL);
                  int smt = sqlite3_step(searchStatement);
                  if (smt == SQLITE_DONE){
  
                      NSLog(@"Deleted");
  
                  } else {
                      NSLog(@"Delete Fail : %d",smt);// alway go fail 
  
                  }
                  return YES;  
              }
          }       
          sqlite3_finalize(searchStatement);
      }
      sqlite3_close(db);
      return NO;
  </code></pre>
  
  <p>please give me Idea if you have any idea.
  Thanks.</p>
  
  <p>Kind Regards,</p>
  
  <p>Kabitis.</p>