title: Writing data to sqlite xCode
body: <p>first of all I am from spain so sorry about my grammar. I am writing some data to a sqlite data base, here is my code: </p>
  
  <pre class="lang-objc prettyprint-override"><code>@try {
  
      NSFileManager *fileMgr=[NSFileManager defaultManager];
  
      NSString *dbPath=[[[NSBundle mainBundle]resourcePath] stringByAppendingPathComponent:@"capturas.sqlite"];
      BOOL succes=[fileMgr fileExistsAtPath:dbPath];
      if(!succes)
      {
          NSLog(@"Cannot locate database '%@'.",dbPath);
      }
      if (!(sqlite3_open([dbPath UTF8String], &amp;dbcapturas)==SQLITE_OK)) {
          NSLog(@"An error has occured: %@",sqlite3_errmsg(dbcapturas));
      }
  
      //sqlite3_stmt *sqlStatement;
      NSString *asd=numero.text;
      NSString *insertStatement=[NSString stringWithFormat:@"INSERT INTO captura(key,tecnico, fecha,provincia,municipio,latitud,longitud,altura,familia,especie,numero,comentario)Values(\"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\", \"%@\")",asd,tecnico,fechaHora,tecnico,municipio,latitud,longitud,altura,tecnico,animal,asd,coment];
      char *error;
      if((sqlite3_exec(dbcapturas, [insertStatement UTF8String], NULL, NULL, &amp;error))==SQLITE_OK)
      {
          NSLog(@"Person inserted.");
      }
      else
      {
          NSLog(@"Error: %s", error);
      }
  } @catch (NSException *exception) { 
      NSLog(@"fail"); 
  }
  @finally {
  
  }
  </code></pre>
  
  <p>the first time I click on the save button I get: </p>
  
  <blockquote>
    <p>2012-07-04 12:17:45.644 adasdasd[1783:f803] Person inserted.</p>
  </blockquote>
  
  <p>and the second time I get : </p>
  
  <blockquote>
    <p>2012-07-04 12:29:18.959 adasdasd[1840:f803] Error: column key is not unique</p>
  </blockquote>
  
  <p>So my code should be ok but when I open the database its totally empty, any idea?</p>