Właściwy sposób wstawiania danych do iPhone'a db

Jak wstawić dane do tabeli w sqlite iPhone?

Próbuję naśladować, ale jego porażka:

<code> NSString *query=[NSString stringWithFormat:@"insert into %@ (name) values ('%@')", table name,myName ];


 sqlite3 *database;

sqlite3_stmt *createStmt = nil;

if (sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) {
    if (createStmt == nil) {

        if (sqlite3_prepare_v2(database, [query UTF8String], -1, &createStmt, NULL) != SQLITE_OK) {
            return NO;
        }
        sqlite3_exec(database, [query UTF8String], NULL, NULL, NULL);
        return YES;
    }

    return YES;
}else {
    return NO;
}
</code>

Stworzyłem tabelę w następujący sposób:

<code>create table if not exists myDets (dets_id integer primary key asc, name text);
</code>

Używam też wtyczki Firefox SQLite do sprawdzania db. Kiedy próbuję wstawić rekord poprzez firefox do mojej bazy danych, pojawia się następujący błąd:

<code>Failed to insert values
Exception Name: NS_ERROR_STORAGE_IOERR
Exception Message: Component returned failure code: 0x80630002 (NS_ERROR_STORAGE_IOERR)        [mozIStorageStatement.execute]
</code>

Źle utknął :(

Używam tego na symulatorze iPhone'a, czy to ma znaczenie?

Proszę pomóż

Z góry dziękuję.

questionAnswers(2)

yourAnswerToTheQuestion