"anna_shahinyan" <annashahin...@yandex.ru> wrote in message news:23171280.p...@talk.nabble.com > I have tried the following but does not help: > > sqlite3_stmt *stmt; > const char *sql_check = "SELECT * FROM MY_DATABASE WHERE id=?"; > NSString *name = nil; > if(sqlite3_prepare_v2(myDatabase, sql_check, -1, &stmt, NULL) == > SQLITE_OK) { > if (sqlite3_step(stmt) == SQLITE_NOTFOUND) { > NSLog(@"Not found"); > } > }
You apparently want to check for a record with a particular ID - aren't you surprised that your code doesn't mention the actual ID anywhere? Your query has a parameter placeholder (the '?' sign). You need to bind its value before running the statement - see sqlite3_bind_int. Finally, sqlite3_step would return SQLITE_DONE when there are no records, not SQLITE_NOTFOUND. Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users