title: Edit the data in SQLite database programmatically
body: <p>I am using following method to update an SQLite table with edited data. I made the edit screen in such a way that on a click of each row of the table view, which gets data from XML, it navigates to a page where I have a text field to enter edited data.</p>
  
  <p>I have a "Save" button in that class. I am not getting how to call this method in that save button event handler. Can any one give me some good tutorial links or example code to edit the SQLite data programmatically?</p>
  
  <pre><code>- (void) saveUpdatedStudentData {
      if(updateStmt == nil) {
          const char *sql = "update tbl_Students Set StudentName = ?,Age =?,Gender =?,DOB =?,StudentID =?,BloodGroup =?,Address =?,Class =?,Section =?,Stream =?,LastName =?,MiddleName =? Where tbl_ID = ?";
  
          if(sqlite3_prepare_v2(database, sql, -1, &amp;updateStmt, NULL) != SQLITE_OK) {
              NSAssert1(0, @"Error while creating update statement. '%s'", sqlite3_errmsg(database));
          }
  
          sqlite3_bind_text(updateStmt, 1, [strstudentName UTF8String], -1, SQLITE_TRANSIENT);
          sqlite3_bind_text(updateStmt, 2, [strAge UTF8String], -1, SQLITE_TRANSIENT);
          sqlite3_bind_text(updateStmt, 3, [strGender UTF8String], -1, SQLITE_TRANSIENT);
          sqlite3_bind_text(updateStmt, 4, [strDOB UTF8String], -1, SQLITE_TRANSIENT);
          sqlite3_bind_text(updateStmt, 5, [strStudentID UTF8String], -1, SQLITE_TRANSIENT);
          sqlite3_bind_text(updateStmt, 6, [strBloodGroup UTF8String], -1, SQLITE_TRANSIENT);
          sqlite3_bind_text(updateStmt, 7, [strAddress UTF8String], -1, SQLITE_TRANSIENT);
          sqlite3_bind_text(updateStmt, 8, [strClass UTF8String], -1, SQLITE_TRANSIENT);
          sqlite3_bind_text(updateStmt, 9, [strSection UTF8String], -1, SQLITE_TRANSIENT);
          sqlite3_bind_text(updateStmt, 10,[strStream UTF8String], -1, SQLITE_TRANSIENT);
          sqlite3_bind_text(updateStmt, 11,[strStuMiddleName UTF8String], -1, SQLITE_TRANSIENT);
          sqlite3_bind_text(updateStmt, 12,[strLastName UTF8String], -1, SQLITE_TRANSIENT);
  
          if(SQLITE_DONE != sqlite3_step(updateStmt))
              NSAssert1(0, @"Error while updating. '%s'", sqlite3_errmsg(database));
  
          sqlite3_reset(updateStmt);
  
  
      }
  }
  </code></pre>